mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2026-01-29 13:50:50 +03:00
Merge pull request #1704 from mini-bomba/darkreader-proofing-the-dynamic-css
Darkreader-proofing the dynamic CSS variables
This commit is contained in:
@@ -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 += "}";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user