XF 2.3 Creating a Dark Mode Variation for a Custom Template?

VisEntities

Active member
Hi everyone,

I'm looking to create a second variation of a template for dark mode by enabling it in the styles variation. I have some custom elements in the template that don't change colors automatically. How can I make these elements support dark mode?

Is it as simple as replicating the template and specifying it for dark mode somewhere? Can someone guide me through the process?

Thanks in advance!


1722839815924.webp
 
Rather than using a fixed hex color code, use a color variable from the style. E.g. instead of #f5f5f5 use an equivalent from the variation as defined in style properties, color palette or basic colors .
e.g. @xf-contentBg
 
Rather than using a fixed hex color code, use a color variable from the style. E.g. instead of #f5f5f5 use an equivalent from the variation as defined in style properties, color palette or basic colors .
e.g. @xf-contentBg
Interesting approach. And I can create new style properties (colors)?
 
I would also advise to uses classes instead of inline style and then define the class elements in extra.less.

So in your example above you could either add the styling elements to the existing class "top-section" or add another class there <div class="top section anotherclass">
 
This post might help:
 
Back
Top Bottom