XenForo 2.3 introduces native Style Variations, allowing a single theme to deliver both light and dark color palettes that sync automatically with a visitor's operating system preference. Configuring variation-aware color palettes, CSS variables, and dual-mode logos eliminates the maintenance overhead of managing separate dark and light child styles.
Enabling Style Variations and System Detection
Before customizing colors, confirm that variation support is active on your primary style so XenForo compiles CSS custom properties for both schemes:
Customizing the Color Palette and Writing Variation-Safe LESS
Open AdminCP > Appearance > Style properties > Color palette to adjust your brand colors. Every swatch—from Neutral 1 through Accent 3—provides side-by-side color pickers for the Default (Light) and Alternate (Dark) variations, along with a live luminance contrast indicator.
When adding custom rules inside extra.less, avoid hardcoding static hex colors like #ffffff or #1a1a1a, which remain fixed when a user toggles modes. Instead, reference XenForo's compiled CSS variables or use LESS functions like xf-intensify() and xf-diminish(), which automatically reverse shading direction in dark mode:
Configuring Dual-Mode Logos and Third-Party Embeds
Dark-colored brand wordmarks disappear against a dark header background if only a single logo asset is defined. Open AdminCP > Appearance > Style properties > Basic options and populate both Logo URL (for light mode) and Alternate logo URL (for dark mode), alongside their corresponding 2x Retina paths.
If an older third-party add-on or embedded widget still renders a bright container in dark mode, target the root data-variation="alternate" attribute inside extra.less to override its background cleanly:
Enabling Style Variations and System Detection
Before customizing colors, confirm that variation support is active on your primary style so XenForo compiles CSS custom properties for both schemes:
- Navigate to AdminCP > Appearance > Styles, click your active theme's title, and verify that Enable variations is checked.
- When enabled, XenForo automatically renders a sun/moon quick-switcher in the public footer and stores each member's choice (Light, Dark, or System) in their account preferences.
- Leave the guest default set to System so new visitors immediately receive the palette matching their device's prefers-color-scheme setting without page flicker.
Customizing the Color Palette and Writing Variation-Safe LESS
Open AdminCP > Appearance > Style properties > Color palette to adjust your brand colors. Every swatch—from Neutral 1 through Accent 3—provides side-by-side color pickers for the Default (Light) and Alternate (Dark) variations, along with a live luminance contrast indicator.
When adding custom rules inside extra.less, avoid hardcoding static hex colors like #ffffff or #1a1a1a, which remain fixed when a user toggles modes. Instead, reference XenForo's compiled CSS variables or use LESS functions like xf-intensify() and xf-diminish(), which automatically reverse shading direction in dark mode:
Kod:
.custom-callout-box {
background: var(--xf-contentAltBg);
color: var(--xf-textColor);
border: 1px solid var(--xf-borderColor);
}Configuring Dual-Mode Logos and Third-Party Embeds
Dark-colored brand wordmarks disappear against a dark header background if only a single logo asset is defined. Open AdminCP > Appearance > Style properties > Basic options and populate both Logo URL (for light mode) and Alternate logo URL (for dark mode), alongside their corresponding 2x Retina paths.
If an older third-party add-on or embedded widget still renders a bright container in dark mode, target the root data-variation="alternate" attribute inside extra.less to override its background cleanly:
Kod:
html[data-variation="alternate"] .legacy-widget-card {
background-color: var(--xf-contentBg);
color: var(--xf-textColor);
}