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

feat: dark mode #3236

Merged
merged 9 commits into from
Mar 6, 2024
Merged

feat: dark mode #3236

merged 9 commits into from
Mar 6, 2024

Conversation

sidvishnoi
Copy link
Member

@sidvishnoi sidvishnoi commented Dec 4, 2020

Closes https://github.com/w3c/respec/issues/2651

Disabled by default. Set respecConfig.darkMode = true to enable.

Please provide feedback if you enable dark mode. You can add ?darkMode=true to your ReSpec spec URL and toggle dark mode in system/browser to preview without making editorial changes.

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.


If you want to try dark mode before this gets merged (please do, to provide feedback), you can replace the respec-w3c script with https://deploy-preview-3236--respec-pr.netlify.app/respec-w3c.js:

- <script src='https://www.w3.org/Tools/respec/respec-w3c' class='remove'></script>
+ <script src='https://deploy-preview-3236--respec-pr.netlify.app/respec-w3c.js' class='remove'></script>

Or, use ReSpec preview (NB: do a hard reload to override service worker there)

@saschanaz
Copy link
Collaborator

Do we know what happened to tr-design dark mode proposal?

@sidvishnoi
Copy link
Member Author

Do we know what happened to tr-design dark mode proposal?

w3c/tr-design#241

@deniak
Copy link
Contributor

deniak commented Aug 30, 2021

The new stylesheet/js have been merged so it is now possible to enable the dark mode on the specifications by following https://www.w3.org/StyleSheets/TR/2016/README.html#dark

@deniak deniak mentioned this pull request Aug 30, 2021
@deniak
Copy link
Contributor

deniak commented Jul 27, 2023

The dark mode stylesheet was deployed about 2 years ago and we had requests from people to add that feature. While editors could include the stylesheet themselves, it might be better to have an option to enable the dark mode which would simply include the stylesheet (https://www.w3.org/StyleSheets/TR/2016/README.html#dark) in the document.

@sidvishnoi sidvishnoi marked this pull request as ready for review March 5, 2024 13:29
@sidvishnoi
Copy link
Member Author

Will add a test too😄

Copy link
Contributor

@marcoscaceres marcoscaceres left a comment

Choose a reason for hiding this comment

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

Looks great... the only thing we should fix as a followup is the MDN buttons... but otherwise, looks really good.

The IDL boxes maybe too... they could probably be made a bit more "dark", but they look fine and will definitely do!

Nice one @sidvishnoi

@sidvishnoi sidvishnoi merged commit 031abec into main Mar 6, 2024
8 checks passed
@sidvishnoi sidvishnoi deleted the dark-mode branch March 6, 2024 11:13
This was referenced Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dark mode in respec
4 participants