Open Bug 1835949 Opened 3 years ago Updated 1 year ago

Show contrast for background in DevTools

Categories

(DevTools :: Inspector, enhancement, P3)

Firefox 113
enhancement

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: egil, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0

Steps to reproduce:

  1. Visit website you want to fix/check e.g.: https://pl.wikipedia.org/wiki/Wikipedia:BATUTA_2023
  2. Inspect button/link with some colourful background.
  3. Try to change background to have good contrast (WCAG / a11y).

Actual results:

No hints from FF when I change background.

Expected results:

Show hints for WCAG AA/AAA contrast for background color picker.

In many cases (most of the time actually) I want to keep the text color the same, but I want to adjust the background to maintain or enhance the contrast. I usually leave the text color black (or change it to white color). It is the background that I usually can (I am allowed to) or want to improve.

The Bugbug bot thinks this bug should belong to the 'DevTools::Inspector' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Inspector
Product: Firefox → DevTools
Duplicate of this bug: 1986145

this is where we enable the contrast computation to be displayed: https://searchfox.org/firefox-main/rev/d0ff31da7cb418d2d86b0d83fecd7114395e5d46/devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js#143-146

// 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" && colorFunction !== "color-mix";

then we'd need to update https://searchfox.org/firefox-main/rev/d0ff31da7cb418d2d86b0d83fecd7114395e5d46/devtools/client/shared/widgets/Spectrum.js#459-461,470,489-495

/* Calculates the contrast ratio for the currently selected
 * color against a single or range of background colors and displays contrast ratio section
 * components depending on the contrast ratio calculated.
...
updateContrast() {
...
  const colorContrast = getContrastRatio(
    {
      ...this.textProps,
      color: this.rgbCssString,
    },
    this.backgroundColorData
  );
See Also: → 1226069
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: