-
-
Notifications
You must be signed in to change notification settings - Fork 4k
docs: improve colors on dark mode #15879
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves dark mode support by enhancing color contrast for WCAG compliance, consolidating CSS theme definitions, and fixing visual inconsistencies. The main achievement is improving the Mongoose logo color contrast from failing to passing WCAG standards by using #FFB4B4 for dark backgrounds.
Key changes:
- Refactored CSS theme system from 4 duplicate blocks to 2 centralized definitions (
:root, [data-theme="light"]and[data-theme="dark"]) - Added brand-specific CSS variables (
--brand-primary,--brand-primary-hover,--brand-primary-subtle) with dark mode variants - Created reusable button component classes (
mongoose-btn-outline,mongoose-btn-solid) with proper dark mode support
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/images/mongoose5_62x30_transparent_light.png | New logo variant with light colors (#FFB4B4) for dark mode backgrounds |
| docs/enterprise.md | Replaced inline button styles with reusable CSS classes |
| docs/css/style.css | Replaced media query dark mode blocks with data-theme attribute selectors; added GitHub button iframe dark mode support |
| docs/css/mongoose5.css | Consolidated theme variable definitions; added brand color variables; created button component styles; improved jobs panel, version dropdown, and menu theming |
| docs/css/api.css | Converted media query dark mode styles to data-theme attribute selectors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@AbdelrahmanHafez I've opened a new pull request, #15880, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: AbdelrahmanHafez <[email protected]>
Remove CSS variable fallbacks for consistency
Co-authored-by: Copilot <[email protected]>
hasezoey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have run it locally, while in dark mode i noticed that when moving between pages, likely due to the removal of @media query, it flashes white for a bit until the js loads and can apply the theme. This is in my opinion very distracting.
(It is also not helped by the fact that body has a transition which can make this "white flash" duration slightly longer)
Also is there a maybe a way i dont know of to also add a @media query to the [data-theme] tags? Having a media query would be good for no-js environments. (not a requirement, but a good to have)
Finally, while we are at it to improve colors:
- the code blocks still look way too blue
- the API pages also look way too blue
- couldnt class
code-theme-darkbe combined intodata-theme?
For some reason the squished text in the homepage's code blocks is back.
|
@hasezoey addressed feedback:
Fixed - restored
Changed dark mode
Done - replaced all
Added line-height: 1.6 to pre code in github.css - the code element wasn't inheriting line-height from its parent pre.
Good call, changed #logo {
background-color: var(--brand-primary);
mask-image: url('/docs/images/mongoose.svg');
}
Removed the redundant |
hasezoey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely looks better now; no more page load flash or too-blue-ness.
Also now that brand-primary colors are applied in dark mode, do you think it would also be feasible for light mode (instead of current link color blue)? (or is the contrast too low?)
FYI just noticed that hompage's #header > h1 > a::before should likely be disabled.
Screenshots
Homepage logo ::before (captured on the live site, but also confirmed here):
Also i dont know a better place, but the Fork me on github banner is somewhat obscuring the theme toggle on the homepage:

Finally, i dont know if this intentional, but the Github Sponsers still have that weird outline around them:

|
FYI
If that should be done, i would like to split link color and code color as otherwise i really think the API page (and any code block) will look too-blue. (and may be confusing as most of the code block things are the link color, but cannot actually be clicked). |





Summary
This PR fixes a few issues with dark mode, mostly contrasts or areas not covered by the original dark mode version.
I'm colorblind so I particularly found that the logo on the left menu had poor contrast and fails WCAG contrast test. I'm not a designer so I used AI to decide the correct color for the mongoose brand on dark mode, and it calculated
#FFB4B4as the mongoose color for dark backgrounds, which passes WCAG contrast test. I modified the CSS code to be parameterized, so that if we decide to change the color from #FFB4B4 to something else, we just need to change it in one place and re-generate the logo with that new color.Changes
WCAG Contrast Test
Homepage & GitHub Buttons
Logo & Sidebar Menu
Version Dropdown
Enterprise Page Buttons
Jobs Panel
CSS Refactoring
Consolidated Theme Variables
Extracted all hardcoded color values into CSS custom properties defined in
mongoose5.css:--brand-primary- Mongoose brand color (#800light,#FFB4B4dark)--btn-bg,--btn-text-shadow- Button styling--tagline-text-shadow- Homepage tagline effect--focus-ring,--focus-ring-shadow- Accessibility focus indicatorsSVG Logo with CSS-controlled Color
Replaced PNG logo swap approach with a single SVG logo using CSS
mask-image:mongoose.svgto usecurrentColorinstead of hardcoded#880000background-color: var(--brand-primary)with SVG as maskNo-JS / System Preference Support
Added
@media (prefers-color-scheme: dark)fallbacks alongside[data-theme="dark"]selectors::root:not([data-theme="light"])pattern to allow manual overrideConsolidated Dark Mode Selectors
.code-theme-darkclass with[data-theme="dark"]attribute selectorstheme-toggle.js[data-theme="dark"]Other Improvements
line-height: 1.5):root).mongoose-btn-outlineand.mongoose-btn-solidclasses for brand buttons