marquisite
Well-known member
We can have light styles, dark styles, or both. There is even a dedicated style property
Some preset text colors such as this, this, this or this are not at all or only barely readable with the default XenForo style. Perhaps someone who posted using one of those poorly contrasting colors was viewing with a dark style where their post looks just fine to them. On the flipside, content formatted with these three preset colors in the default style seems perfectly readable, but with a dark style it could be obscured or illegible.
To an extent, some of this issue can be worked around by overriding certain preset colors with more appropriate lighter/darker color in the extra.less template. For example, the below bit of CSS uses the LESS contrast function to override absolute white and black text to whichever color best contrasts against the content background (E.g. white text becomes black with the default style):
(This CSS assumes that either the dark style or light style is a child of the other, with the child's extra.less inherited from the parent)
This workaround seems fine, I think, if only addressing the 27 preset colors. However it starts looking rather unwieldy once you start trying to tackle the endless number of other possible combinations for when a poster manually customizes the COLOR BB code value to something different.
Searching brought up some related past threads, however neither of them fully address this issue:
styleType
that xf-intensify and xf-diminish reference to determine how they alter a color (E.g. darken/lighten). I'm now looking at adding a dark style to my forum alongside a light one. This prospect has unearthed a limitation with the [COLOR]
BB code with some poor contrast issues for the user-generated text on a per-style basis. Can anything be changed within XenForo itself so that [COLOR]
's rendered color can be adjusted to improve contrast across different styles, such as darkening/lightening based on the contentBg or styleType (light/dark) style properties?Some preset text colors such as this, this, this or this are not at all or only barely readable with the default XenForo style. Perhaps someone who posted using one of those poorly contrasting colors was viewing with a dark style where their post looks just fine to them. On the flipside, content formatted with these three preset colors in the default style seems perfectly readable, but with a dark style it could be obscured or illegible.
To an extent, some of this issue can be worked around by overriding certain preset colors with more appropriate lighter/darker color in the extra.less template. For example, the below bit of CSS uses the LESS contrast function to override absolute white and black text to whichever color best contrasts against the content background (E.g. white text becomes black with the default style):
CSS:
.message-body .bbWrapper
{
& span[style*="color: rgb(255, 255, 255)"],
& span[style*="color: rgb(0, 0, 0)"]
{
color: contrast(@xf-contentBg,rgb(0, 0, 0),rgb(255, 255, 255)) !important;
}
}
This workaround seems fine, I think, if only addressing the 27 preset colors. However it starts looking rather unwieldy once you start trying to tackle the endless number of other possible combinations for when a poster manually customizes the COLOR BB code value to something different.
Searching brought up some related past threads, however neither of them fully address this issue:
XF 1.5 - Font color
I have as the main style a dark one. 1 Child I reversed the color to have a light one. This is all working like expected. But if someone use the dark style and choose as font color white and vice versa light style and font color black it is not readable in the other style. You have to select...
xenforo.com
XF 2.2 - Custom text color with dark/light theme options for users
Hello, I've built a custom dark theme, and enabled both dark/light theme selection for users. Now I'm thinking about a problem: if in the dark theme an users select full white #fff color for the text, users with the light theme won't read the message content... What could I do?
xenforo.com
XF 2.2 - Problem with font colour in dark style
My forum has light and dark styles. If I post a fix then in light styles there is no problem, but in dark style there is a problem with the same font color: - picture one is from a light style: Picture two is the same, but in dark style: The problem that I have, is that I have no clue...
xenforo.com
Adding standard colors for text palette
Hi! Please, add standard colors, like red, blue, green [color=blue] e.t.c.
xenforo.com
Last edited:
Upvote
2