Use light-dark() in variables.css
Categories
(DevTools :: General, task)
Tracking
(firefox132 fixed)
Tracking | Status | |
---|---|---|
firefox132 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
Details
Attachments
(1 file)
At the moment, we 2 rules, on for light theme, the other for dark theme, in which we declare hundreds of CSS variables. The CSS variable definition are duplicated, and adding one variable mean adding it to both rules, adding the same comment if one is needed. Since there are a lot of variable, editing one in light mode, then looking for the one in dark mode is a bit cumbersome.
Using light-dark()
will allow us to only declare variables in one place
Assignee | ||
Comment 1•10 months ago
|
||
Updated•10 months ago
|
Comment 3•10 months ago
•
|
||
Backed out for causing multiple dt failures
Failure log 1 // Failure log 2 // Failure log 3 // Failure log 4
Assignee | ||
Comment 4•10 months ago
|
||
Those tests are failing because with my patch, getColor
is broken https://searchfox.org/mozilla-central/rev/c4966e1c1e6a8cb38c15a27693e8ecd63082055e/devtools/client/shared/theme.js#71-86
const getColor = (exports.getColor = (type, theme) => {
const themeName = theme || getTheme();
let themeFile = getThemeFile(themeName);
let match = themeFile.match(new RegExp("--theme-" + type + ": (.*);"));
const variableMatch = match ? match[1].match(/var\((.*)\)/) : null;
// Check if the match is a color variable and retrieve the value of the color variable
// if needed
if (variableMatch) {
themeFile = getThemeFile("root");
match = themeFile.match(new RegExp(`${variableMatch[1]}: (.*);`));
}
// Return the appropriate variable in the theme, or otherwise, null.
return match ? match[1] : null;
});
This is used to send colors to the server so it can generate screenshots with the right colors (e.g. for Font preview)
Description
•