Closed Bug 2047863 Opened 2 months ago Closed 2 months ago

Don't show contrast information for base color in alpha()

Categories

(DevTools :: Inspector: Rules, defect, P2)

defect

Tracking

(firefox154 fixed)

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: nchevobbe, Assigned: nchevobbe)

References

Details

Attachments

(2 files)

Attached file test_case.html

Steps to reproduce

  1. With layout.css.alpha-color-function.enabled set to true (should already be the case on Nightly)
  2. Open the attached test case
  3. Inspect the <h1> element
  4. In the color declaration of the h1 rule, click on the color swatch after the from keyword (before var(--mycolor))

Actual results

Contrast information are displayed in the color picker, but that's not what is used for the final color, so it could be confusing.


We should do like we did for other color functions in https://searchfox.org/firefox-main/rev/ccf89bb4e01e2a64f86cce9a39757535df9a693d/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js#103-115,157-161

static COLOR_MODIFYING_FUNCTIONS = new Set([
  "color-mix",
  "contrast-color",
  // color functions can take a relative color after `from`
  "color",
  "hsl",
  "hwb",
  "lab",
  "lch",
  "oklab",
  "oklch",
  "rgb",
]);
...
  // Only enable contrast if the type of property is color
  // and its value isn't inside a color-modifying function (e.g. color-mix()).
  this.spectrum.contrastEnabled =
    name === "color" &&
    !SwatchColorPickerTooltip.COLOR_MODIFYING_FUNCTIONS.has(colorFunction);
Assignee: nobody → nchevobbe
Status: NEW → ASSIGNED
Severity: -- → S3
Priority: -- → P2
Pushed by nchevobbe@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/093870551502 https://hg.mozilla.org/integration/autoland/rev/ce7be0cbf149 [devtools] Don't display contrast information in color tooltip for relative color in alpha(). r=devtools-reviewers,ochameau.
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
Regressions: 2049102
QA Whiteboard: [qa-triage-done-c155/b154]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: