Skip to content

Setup dark mode based on work in rdf-primer and elsewhere. #88

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

gkellogg
Copy link
Member

@gkellogg gkellogg commented Mar 13, 2025

Some simplifications to table styling were done for simplicity. Not sure that the subtle use of color for tables in light-mode is as effective in dark-mode.


Preview | Diff

@gkellogg gkellogg added the spec:editorial Minor change in the specification (markup, typo, informative text; class 1 or 2) label Mar 13, 2025
@gkellogg gkellogg requested review from niklasl, domel and TallTed March 13, 2025 23:16
spec/index.html Outdated
--hue-5-2: #be5046;
--hue-6: #d19a66;
--hue-6-2: #e6c07b;
}
Copy link

@Tpt Tpt Mar 14, 2025

Choose a reason for hiding this comment

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

This might lead to bugs in the future if respec/hljs is updated. I don't think we pin ReSpec version. I am going to open a ticket in ReSpec about it.

Copy link

Choose a reason for hiding this comment

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

@Tpt That would be great! I failed to act on w3c/rdf-primer#24 and haven't moved this CSS to rdf-common yet. But fixing it in ReSpec would be much better for all! (I probably should have gone that route from the beginning.)

(I might follow with what I've come up with re. highlighting, since ReSpec seems to handle that in a somewhat deprecated manner (CommonJS vs. ESM).)

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the hljs styling. Until it is applied to ReSpec, example blocks will continue to have a white background in dark mode, but better not tie that style into the HTML on a one-off basis.

Copy link

Choose a reason for hiding this comment

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

I commented on speced/respec#4871 (comment) to mention the tentative solution for the Primer. Unless someone picks it up there, I might have some time for a PR on ReSpec, which as @Tpt says would be for the best (and the only robust solution).

Copy link

Choose a reason for hiding this comment

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

I also commented on speced/respec#4871 (comment) Sadly, fixing properly does not sound trivial.

Copy link

Choose a reason for hiding this comment

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

@Tpt Important comment! (I agree it's not trivial, alas; but I think you're on to something there!)

Copy link

Choose a reason for hiding this comment

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

Aiming to solve this via speced/respec#4925.

@gkellogg gkellogg requested a review from Tpt March 14, 2025 21:01
@@ -52,13 +53,16 @@
</script>

<style>
body { color-scheme: light; }
Copy link

Choose a reason for hiding this comment

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

This prevents darkmode to work when JS is not enabled but not sure if it's a big deal.

Copy link

Choose a reason for hiding this comment

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

That should be handled in speced/respec#4925 (to avoid the JS dependency both for hljs and SVGs). If that PR lands, the two places where color-scheme is used this PR is obsolete (since they depend on JS)). Do we want to hold off on merging dark mode on RDF specs until we get a signal on if respec will accept the fix?

Copy link

Choose a reason for hiding this comment

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

Imho we should merge now. JS only dark mode is better than no dark mode.

Copy link

Choose a reason for hiding this comment

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

Agreed; with the added suggestion to remove those two lines to avoid required further changes (the use of color-scheme here should only affect SVGs).

Comment on lines +56 to +57
body { color-scheme: light; }
body.darkmode { color-scheme: dark; }
Copy link

Choose a reason for hiding this comment

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

Suggested change
body { color-scheme: light; }
body.darkmode { color-scheme: dark; }

These should only affect linked SVGs (which this spec does not currently use). Since general support for that will be handled by respec if speced/respec#4925 is merged, removing these lines should happen anyway when that lands, to avoid hard-to-spot regressions (since the upstream fix is not JS-dependent).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec:editorial Minor change in the specification (markup, typo, informative text; class 1 or 2)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants