Mawu has filters and actions for developers who want to add themes, change the schedule, style the visitor switch or limit who can change settings. This page lists them. All of them are in the free plugin unless marked Pro.
Make your admin screens match Mawu
If you build a plugin, use Mawu’s CSS variables with your normal colour as the fallback. Your screens are then dark from the first paint for anyone on a Mawu theme, and unchanged for everyone else.
background: var(--mawu-surface, #fff);
color: var(--mawu-text, #1d2327);
Available: --mawu-bg, --mawu-surface, --mawu-surface-alt, --mawu-border, --mawu-text, --mawu-text-muted, --mawu-accent and --mawu-link. They are set on <body> only when the person viewing uses a Mawu theme.
Themes
| Hook | Type | What it does |
|---|---|---|
mawu_palette_themes |
filter | Add or change themes. Each theme is a label plus 12 colours as #rrggbb, with an optional on_accent text colour. |
mawu_palette_collections |
filter | Group themes into collections. Every theme ends up in exactly one collection. |
mawu_theme_asset |
filter | Change the stylesheet Mawu uses for a theme (admin colours, block editor canvas, Classic Editor, login page). |
mawu_palette_for_user |
filter | Change a theme’s colours for one person. Pro’s intensity and OLED black use it. |
mawu_selectable_themes |
filter | Limit which themes a person can pick. An empty answer means no limit, so a list is never empty. |
Schedule
| Hook | Type | What it does |
|---|---|---|
mawu_schedule_settings |
filter | Read or extend a person’s schedule settings. |
mawu_schedule_sanitize |
filter | Clean extra schedule fields when the schedule is saved. |
mawu_dark_hours_now |
filter | Decide whether a person’s schedule is dark right now. |
mawu_schedule_window_end |
filter | When the current dark window ends. |
mawu_schedule_status |
filter | The status line, for example “Dark now, until 07:00.” |
mawu_schedule_summary |
filter | The summary line at the top of the settings page. |
mawu_hours_fields |
action | Print extra fields in the Schedule panel’s form. |
Settings page
| Hook | Type | What it does |
|---|---|---|
mawu_brand_name |
filter | The plugin’s name in the menu and page titles. White-label uses it. |
mawu_show_promotions |
filter | Return false to hide the rating note, review links and the Mawu Pro block. |
mawu_settings_capability |
filter | The capability for each part of the settings (see below). |
mawu_hub_after_section |
action | Print your own section after one of the page’s sections. |
mawu_hub_preview_args |
filter | Change the drawn admin preview and its caption. |
mawu_hub_page_sections |
action | Print a section at the end of the Tools panel. |
mawu_quick_switch_available |
filter | Hide the dark mode button and shortcut for a person or a screen. |
Capabilities
mawu_settings_capability receives the capability and a context:
| Context | Default | Covers |
|---|---|---|
hub |
manage_options |
The Mawu page |
options |
manage_options |
Site-wide settings |
rating |
manage_options |
The rating note |
use_theme |
read |
Picking a theme and the quick switch (on top of editing your own profile) |
hours |
read |
Saving your own schedule |
theme_builder |
manage_options |
The theme builder (Pro) |
An empty answer falls back to the default.
Export and import
| Hook | Type | What it does |
|---|---|---|
mawu_export_data |
filter | Add your own settings to the export file. |
mawu_import_data |
filter | Read your settings back on import, and add rows to the preview. |
mawu_transfer_labels |
filter | Readable names for your settings in the import preview. |
Visitor dark mode and the switch
| Hook | Type | What it does |
|---|---|---|
mawu_frontend_enabled |
filter | Turn visitor dark mode off for a request, for example on one section of your site. |
mawu_frontend_theme_maps |
filter | Add or change the colour map for a classic theme. |
mawu_frontend_image_dim |
filter | How much photos dim in dark mode (0.5 to 1). Logos and SVG images are never dimmed. |
mawu_frontend_logo |
filter | An image shown as the logo in dark mode. |
mawu_frontend_image_swap |
filter | Extra light-to-dark image swaps. |
mawu_frontend_toggle_styles |
filter | Add a switch design to the Design list. |
mawu_frontend_design_icons |
filter | The small drawing for each design in the Design list. |
mawu_frontend_switch_markup |
filter | Change the switch’s classes, style, icons, text and accessible name. |
mawu_frontend_switch_settings |
filter | Clean your own switch settings when they are saved. |
mawu_frontend_switch_transfer_fields |
filter | Include your switch settings in export, import and sync. |
mawu_frontend_switch_fields |
action | Print fields in the Switch group. |
mawu_frontend_switch_place |
action | Print a row under the corner and distance fields. |
mawu_frontend_extra_fields |
action | Print fields in the “Never darken and photos” group. |
mawu_frontend_groups |
action | Print a whole group in the Frontend panel. |
mawu_frontend_preview_tools |
action | Print buttons in the preview toolbar. |
Dark versions of images (Pro)
Add data-mawu-dark-src, data-mawu-dark-srcset or data-mawu-dark-poster to an <img> or <video>, or data-mawu-dark-bg to an element with an inline background image. Mawu Pro swaps them while a visitor has dark mode on.
Links
?mawu=dark, ?mawu=light and ?mawu=auto work on any page of the site. They are handled in the browser, so page caches don’t vary.
Pro
| Hook | Type | What it does |
|---|---|---|
mawu_effect_packs |
filter | Add a seasonal effect pack, with its theme collection, season and script. |
mawu_sync_client_ip |
filter | The client address settings sync rate-limits by. Use it behind a proxy, and read only a header your own proxy sets. |
Questions
Ask in the support forum if you need a hook that isn’t here.