Skip to content

Colour Customisation, in Depth

Using the module's CSS custom properties directly for customisation beyond the Colours tab.

Updated 1 min read

Every colour token the module uses is a plain CSS custom property, scoped to that specific module instance's DOM id (#modw-123, where 123 is the module id). This means:

  • The Colours Tab is a convenience UI over these variables — everything it can do, you can also do by hand.
  • If you need something the tab doesn't expose (a different colour on hover, per-breakpoint changes, a completely custom gradient direction on only one layout), you can add your own CSS, in your template's custom CSS file or a template override, targeting the same module id:
#modw-123 {
    --mw-bg: #101820;
    --mw-accent: #d946ef;
    --mw-grad: linear-gradient(140deg, #d946ef 0%, #7c3aed 45%, #1e1b4b 100%);
}

Find a module's id by inspecting its wrapping element in your browser's developer tools, or from the URL when editing it in the admin (...&id=123...).

A hand-written rule like this overrides the Colours tab's choices for that one property, and still respects prefers-color-scheme automatically if you wrap the dark variant in a media query:

#modw-123 { --mw-accent: #2563eb; }

@media (prefers-color-scheme: dark) {
    #modw-123 { --mw-accent: #60a5fa; }
}

Was this article helpful?

Image

Everything you need to build on Joomla — one subscription away.

Resources