Generate darkreader variables with our category color variables

This ensures the timeline, fv labels and thumbnail labels don't go transparent if darkreader forgets to set it's variable overrides.
This commit is contained in:
mini-bomba
2023-03-21 20:38:20 +01:00
parent f6a42a7908
commit e159989f17

View File

@@ -2445,9 +2445,11 @@ function setCategoryColorCSSVariables() {
let css = ":root {" let css = ":root {"
for (const [category, config] of Object.entries(Config.config.barTypes)) { for (const [category, config] of Object.entries(Config.config.barTypes)) {
css += `--sb-category-${category}: ${config.color};`; css += `--sb-category-${category}: ${config.color};`;
css += `--darkreader-bg--sb-category-${category}: ${config.color};`;
const luminance = GenericUtils.getLuminance(config.color); const luminance = GenericUtils.getLuminance(config.color);
css += `--sb-category-text-${category}: ${luminance > 128 ? "black" : "white"};`; css += `--sb-category-text-${category}: ${luminance > 128 ? "black" : "white"};`;
css += `--darkreader-text--sb-category-text-${category}: ${luminance > 128 ? "black" : "white"};`;
} }
css += "}"; css += "}";