Closed Bug 1911733 Opened 10 months ago Closed 9 months ago

Use light-dark() in variables.css

Categories

(DevTools :: General, task)

task

Tracking

(firefox132 fixed)

RESOLVED FIXED
132 Branch
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: nobody → nchevobbe
Status: NEW → ASSIGNED
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/cfa6ec757a97 [devtools] Use light-dark in variables.css. r=devtools-reviewers,bomsy.

Backed out for causing multiple dt failures

Backout link

Push with failures

Failure log 1 // Failure log 2 // Failure log 3 // Failure log 4

Flags: needinfo?(nchevobbe)

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)

Flags: needinfo?(nchevobbe)
Depends on: 1915872
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2e869929ad46 [devtools] Use light-dark in variables.css. r=devtools-reviewers,bomsy.
Status: ASSIGNED → RESOLVED
Closed: 9 months ago
Resolution: --- → FIXED
Target Milestone: --- → 132 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: