frm
Well-known member
- Affected version
- 2.3
I'm unsure whether this is a bug, or whether it can even be addressed.
However, with style variants, we can set different styles for different variants: light/dark.
The problem comes into play when the style is system, the default. Until they select light or dark, they will get the XF default style settings served to them
If
This is also a problem for current visitors who haven't saved a preference as
Certainly, there has to be a way to grab the header and set a temporary cookie, or another method, before the page renders the CSS so that the appropriate style can be rendered with the modifications for light/dark.
However, with style variants, we can set different styles for different variants: light/dark.
CSS:
.m-colorScheme(light,
{
...
}
);
.m-colorScheme(dark,
{
...
}
);
The problem comes into play when the style is system, the default. Until they select light or dark, they will get the XF default style settings served to them
If
Sec-CH-Prefers-Color-Scheme
is being used to determine light or dark mode, it seems like a cookie can be set for light or dark mode, and perhaps, the code above work. And, if they come back with a new request different from the set cookie, (i.e., first came as dark but now came as light), it could reset the cookie and serve the appropriate code. I don't know of a solution for that.This is also a problem for current visitors who haven't saved a preference as
style_variation
as default, alternate, or empty/null (for system in xf_user
.Certainly, there has to be a way to grab the header and set a temporary cookie, or another method, before the page renders the CSS so that the appropriate style can be rendered with the modifications for light/dark.