Skip to content

Popup & settings page: partial support for forced colors mode (high contrast) - #9153

Open
mxmou wants to merge 6 commits into
ScratchAddons:masterfrom
mxmou:windows-contrast
Open

Popup & settings page: partial support for forced colors mode (high contrast)#9153
mxmou wants to merge 6 commits into
ScratchAddons:masterfrom
mxmou:windows-contrast

Conversation

@mxmou

@mxmou mxmou commented Aug 7, 2026

Copy link
Copy Markdown
Member

Changes

Fixes some issues in the extension UI that made it difficult to use when the forced colors mode was enabled. Side-by-side comparison on Edge:

1.45.2 This PR
Switch (on) image image
Switch (off) image image
Category selector image image
Color picker image image

The full settings page looks like this:

image

And with a light color scheme (the default one on Firefox):

image

Known issue

A remaining issue is that icons don't have the right color (they might even be invisible, as seen in the screenshot above). This could be solved by using an icon font, as suggested in #1220, or inline SVGs, as suggested in #4989.

Testing

There are several ways to turn on forced colors when testing these changes:

  • System-wide setting on Windows: several preset color schemes are available in Windows settings → Accessibility → Contrast themes. It's also possible to choose custom colors.
  • Developer setting on Chromium browsers: enable the forced-colors media feature on the Rendering tab in devtools.
  • Browser setting on Firefox: Settings → Accessibility → Website contrast. A custom color scheme can be set.

@mxmou mxmou self-assigned this Aug 7, 2026
@mxmou mxmou added scope: webpages Related to the web pages (settings page, pop-up, etc) scope: accessibility Addresses an accessibility issue labels Aug 7, 2026

@DNin01 DNin01 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on Edge 151 using the page colors accessibility setting.

Comment thread webpages/settings/style.css Outdated
Comment on lines +433 to +435
.color-container {
forced-color-adjust: none;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This style rule applies to all elements inside the color input, including the color picker, preventing it from being fully accessible. This should be applied only to the color input, color well, and sliders.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's possible to do that - those elements are in the picker's shadow DOM and are only affected by style elements inside the shadow root.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant by modifying the color picker component's own stylesheet to make the color well and color sliders appear as normal while all of its other elements are adjusted by the browser.

If you were talking about the forced-color-adjust property, it does affect the shadow root's elements, strangely. It's probably being inherited, because when I remove the property, everything in the color picker reverts to your "before" color picker screenshot. Knowing this, the effect could be counteracted with this style rule:

color-picker {
  forced-color-adjust: auto;
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file you linked is a minified library that isn't meant to be edited directly.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could still do one of these things:

  • The JavaScript is minified, but I don't see a problem with modifying the template literals that encode the stylesheets used by this library's components.
  • Since the components are open shadow roots, their shadow DOM can be modified from the outside after insertion, allowing non-library code to patch in additional CSS.
  • We can switch to a different color picker library.
  • We can save this for a different PR.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • We can switch to a different color picker library.
  • We can save this for a different PR.

I think we need to switch a different color picker anyway (the current one has quite a few bugs), but that can be done in a future PR.

Comment thread webpages/settings/style.css
Comment thread webpages/settings/style.css
@mxmou
mxmou force-pushed the windows-contrast branch from 1578a84 to bc62622 Compare August 8, 2026 19:04

@DNin01 DNin01 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than forced colors not being applied to the color picker, I think this is an improvement.

I kind of wish, though, that fewer of these forced-colors media queries had to be used. Perhaps setting different values for the CSS variables in the colors.css file when forced colors are active would help save some lines of code now and in the future? Just an idea. Kinda difficult without a refactor, though.

@DNin01 DNin01 added the status: needs review PR needs 1 more approval label Aug 10, 2026
@DNin01
DNin01 requested a review from WorldLanguages August 10, 2026 23:38
@DNin01

DNin01 commented Aug 10, 2026

Copy link
Copy Markdown
Member

@Samq64, you might be interested in testing and reviewing this.

@DNin01 DNin01 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a couple more issues.

@media (forced-colors: active) {
.icon-button {
background-color: ButtonFace;
outline: 1px solid ButtonBorder;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Button outlines don't change color when focused.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The focus ring is difficult to see over highlighted backgrounds like selected option rows and categories.

Option row with selected and focused item

Maybe it could be changed to HighlightText and inset a bit? I'm not sure what's standard for these.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll probably change the outline to be outside the element and slightly offset. That's what Windows itself does for most focused elements, including those which have the highlight color as the background color:

image image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: accessibility Addresses an accessibility issue scope: webpages Related to the web pages (settings page, pop-up, etc) status: needs review PR needs 1 more approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants