Show contrast for background in DevTools
Categories
(DevTools :: Inspector, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: egil, Unassigned)
References
Details
Attachments
(1 file)
|
18.32 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0
Steps to reproduce:
- Visit website you want to fix/check e.g.: https://pl.wikipedia.org/wiki/Wikipedia:BATUTA_2023
- Inspect button/link with some colourful background.
- 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.
Comment 1•3 years ago
|
||
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.
Comment 3•1 year ago
|
||
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
);
Updated•1 year ago
|
Description
•