"* CSS breaks / does not load correctly for white and black seeded themes."
This is not conditional to seed. Also, it usually resolves itself after the first page load (except for previews which re-generate on every page load).
>> All other bullets in this issue are resolved, although there may still be a few hidden colour contrast issues in themes.
Also added luminance and colour contrast functions to themewizard.php .
---
Added new themewizard equation: contrast. This outputs a new colour given the provided contrast ratio (the HSV value and saturation are adjusted until the contrast ratio is met or both value and saturation reached their min/max allowed).
Example use: {$THEMEWIZARD_COLOR,#ffffff,seed_contrast_medium,100% (seed contrast 4.5)} [outputs a new color that has a contrast ratio of up to 4.5 compared to the seed colour]
---
Added {$THEME_COLOUR_IS_BRIGHT,colour} Tempcode symbol. Returns 1 if the luminance of the specified colour is 0.5 or higher, else returns 0. Can be used to determine when to use white versus black text. For example:
/*{+START,IF,{$THEME_COLOUR_IS_BRIGHT,{$GET,button_primary}}}*/
.btn-primary img.icon {
/* When the buttons are bright, we do not want their icons to be white after-all */
filter: none !important;
}
/*{+END}*/
This makes the icons on the primary buttons black when the button colour is bright.
With my latest commit ( https://gitlab.com/composr-foundation/composr/-/commit/b2f52d9aa84f338e6903e857271f55bd91333e7f ), box_title_text_2 was changed from white to black automatically for the default theme / seed due to the new contrast ratio calculator.
Black seems to be less visible against the seed background than white was, so I thought this was a bug. However, when I calculated the black / white color contrasts, black came out at 5.31 whereas white was 3.95. So technically, the theme wizard was correct in choosing black according to WCAG standards despite it looking less visible to me personally.
May want to review this more. Maybe the WCAG algorithm is flawed.
Edit: The WCAG 2.0 standard is indeed flawed. WCAG 3.0 / APCA is much more accurate.
Additional note, while what I said above about WCAG 2.1 is true and that I still recommend WCAG 3.0 / APCA, a good PHP implementation is not yet available. So I'm using luminance instead of contrast ratio to determine black versus white text.
Second item: Not true
This is not conditional to seed. Also, it usually resolves itself after the first page load (except for previews which re-generate on every page load).
>> All other bullets in this issue are resolved, although there may still be a few hidden colour contrast issues in themes.
---
Added new themewizard equation: contrast. This outputs a new colour given the provided contrast ratio (the HSV value and saturation are adjusted until the contrast ratio is met or both value and saturation reached their min/max allowed).
Example use: {$THEMEWIZARD_COLOR,#ffffff,seed_contrast_medium,100% (seed contrast 4.5)} [outputs a new color that has a contrast ratio of up to 4.5 compared to the seed colour]
---
Added {$THEME_COLOUR_IS_BRIGHT,colour} Tempcode symbol. Returns 1 if the luminance of the specified colour is 0.5 or higher, else returns 0. Can be used to determine when to use white versus black text. For example:
/*{+START,IF,{$THEME_COLOUR_IS_BRIGHT,{$GET,button_primary}}}*/
.btn-primary img.icon {
/* When the buttons are bright, we do not want their icons to be white after-all */
filter: none !important;
}
/*{+END}*/
This makes the icons on the primary buttons black when the button colour is bright.
Black seems to be less visible against the seed background than white was, so I thought this was a bug. However, when I calculated the black / white color contrasts, black came out at 5.31 whereas white was 3.95. So technically, the theme wizard was correct in choosing black according to WCAG standards despite it looking less visible to me personally.
May want to review this more. Maybe the WCAG algorithm is flawed.
Edit: The WCAG 2.0 standard is indeed flawed. WCAG 3.0 / APCA is much more accurate.
Additional note, while what I said above about WCAG 2.1 is true and that I still recommend WCAG 3.0 / APCA, a good PHP implementation is not yet available. So I'm using luminance instead of contrast ratio to determine black versus white text.