This repository was archived by the owner on May 17, 2024. It is now read-only.
A simple dark theme support #130
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is based on #129. If #129 should be merged, this branch is supposed to be rebased on it.
I add some dark theme support (automatically reads user's preference, and without a manual toggle switch), possibly solves #114.
I noticed that the CSS for highlighted code blocks was from
gfmmodule. So I think I should continue to usegfmfor code blocks under dark theme, and it does have dark theme support.Syntax highlights were successful since colors applied to both
.markdown-body .highlight .token.keywordand.gfm-highlight .token.keywordand our code block matches the later one.However
gfm's dark theme overrides for color variables fails unless we addto the element. And since syntax highlighting's default color only applies to
.markdown-body .highlight preand.markdown-body pre, which means if we'd like to reusegfm's CSS rules without modifyinggfmitself, the code block needs to be a child of.markdown-body.However being a child of
.markdown-bodybrings in some other CSS rules. I override itspaddingandbackground-colorusing inlinestyleattribute, which fix things a little, but other rules thefont-size,line-heightandoverflowset bytext-smandsm:overflow-hiddenwas also overridden by rules for.markdown-bodyingfm.css. Luckily, these changes seems to be subtle.