Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color contrast issues #4871

Open
Tracked by #2410
pkra opened this issue Jan 9, 2025 · 3 comments
Open
Tracked by #2410

color contrast issues #4871

pkra opened this issue Jan 9, 2025 · 3 comments
Labels

Comments

@pkra
Copy link

pkra commented Jan 9, 2025

While working on w3c/aria#2410 I found some contrast issues that can also be observed on https://respec.org/docs/.

  • TOC
    • light & dark mode: "Tables of Content" has insufficient contrast (due to var(--tocsidebar-heading-text))
    • dark mode: .toc code {#005a9c} leads to insufficient contrast
  • highlight.js: in dark mode, the color theme causes contrast issues in most code snippets, in particular html.
  • WebIDL: in light mode, "WebIDL" has insufficient contrast (.idlHeader { color: var(--defrow-border,#fff)})

I'll update this issue if I find more.

@sidvishnoi
Copy link
Member

Apart from syntax highlighting (part of ReSpec), we'd need to file above in w3c/tr-design repo, as same colors get used by Bikeshed too (base.css).

I'll try finding some time this weekend to address this. Happy to review PRs though.

@pkra
Copy link
Author

pkra commented Jan 9, 2025

Thanks @sidvishnoi.

Is there a way to configure the highlight.js theme in the respec configuration? It offers some themes with better contrast.

@SamB
Copy link

SamB commented Jan 20, 2025

Hmm. The dark mode PR (#3236) said this:

This gives a "good enough" support for dark mode. Not all styles are perfected yet.
And some styles can't be overridden by the manual theme toggle (they only respect @media (prefers-color-scheme: dark) {...}).
I've tried to use W3C stylesheets's CSS variables wherever possible to avoid this, but at least styles for code syntax highlighting (including WebIDL), and definition panel aren't supported in that theme, so they won't fully respect the manual theme toggle.

Apparently relating to the following blocks of code:

/* There's no way to adapt this to "manual" theme toggle yet. */
@media (prefers-color-scheme: dark) {
.hljs {
--base: #282c34;
--mono-1: #abb2bf;
--mono-2: #818896;
--mono-3: #5c6370;
--hue-1: #56b6c2;
--hue-2: #61aeee;
--hue-3: #c678dd;
--hue-4: #98c379;
--hue-5: #e06c75;
--hue-5-2: #be5046;
--hue-6: #d19a66;
--hue-6-2: #e6c07b;
}
}

/* There's no way to adapt this to "manual" theme toggle yet. */
@media (prefers-color-scheme: dark) {
:root {
--assertion-border: #444;
--assertion-bg: var(--borderedblock-bg);
--assertion-text: var(--text);
}
}

It seems that the issue is that https://github.com/w3c/tr-design/blob/gh-pages/src/fixup.js can disable W3C's dark-mode stylesheet but nobody else's.

#4687 is basically about how to handle it here, w3c/tr-design#349 was about having fixup.js set a global class, but that (afaik) won't ultimately work for viewing a pre-processed spec with JavaScript turned off. I filed w3c/tr-design#363 requesting an explanation of how to use the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants