-
Notifications
You must be signed in to change notification settings - Fork 2
Add automatic dark theme support via prefers-color-scheme #24
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: main
Are you sure you want to change the base?
Conversation
Co-authored-by: baywet <[email protected]>
Co-authored-by: baywet <[email protected]>
Co-authored-by: baywet <[email protected]>
|
@copilot when using the dark theme, I'm getting a white box in the top right corner where the links "latest arazzo spec" and others are, can you fix that? Also I'm getting a white navigation highlight on the left, this should be a darker color to provide better contrast for the links |
Co-authored-by: baywet <[email protected]>
Fixed both issues in commit 420df56:
|
|
@copilot make the navigation highlight a light grey without color gradient. |
Co-authored-by: ralfhandl <[email protected]>
|
@copilot code syntax highlighting, for example on page oas/3.2/schema/2025-09-17.html, shows a white background. Please make it dark. |
Co-authored-by: ralfhandl <[email protected]>
Fixed syntax highlighting background in commit 72b8279. Added dark background styles for |



Summary
This PR implements automatic dark theme support for the OpenAPI Initiative website. The theme automatically switches based on the user's operating system color scheme preference using the CSS
prefers-color-schememedia query, with no manual controls required.Changes Made
_sass/custom/custom.scssprefers-color-schememedia query!importantdeclarations and consolidate dark mode styles--aux-nav-bgvariable for proper dark background--nav-highlightvariable with darker color for better contrast#44434dto#3d3d3dfor a pure neutral grey without color gradient.hljs,pre.nohighlight, andpre codeelements with adjusted syntax colors for dark mode readabilityImplementation Details
Light Mode (Default):
Dark Mode:
Technical Approach
@media (prefers-color-scheme: dark)query for dark modeTesting
Tested with both light and dark themes to ensure proper color contrast and readability in both modes.
Screenshots:
Browser Compatibility
The
prefers-color-schememedia query is supported in all modern browsers:Users on older browsers will see the default light theme.
Security Summary
No security vulnerabilities introduced. Changes are purely cosmetic CSS modifications that improve user experience.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.