Add CSS variable to override font for easy theming #6439
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.
Changes
This PR adds a couple CSS variables for the user to override in order to add a custom font.
Why not just overwrite it using a custom
html
rule with afont-family
property? There are "typography" elements that manually re-specify the font family, and given that those class names seem to be hash based, they would be subject to change as the CSS would change, assuming I'm right.Added vars to override:
--jf-font-override
--jf-font-override--ja
--jf-font-override--ko
--jf-font-override--zh-CN
--jf-font-override--zh-TW
--jf-font-override--zh-HK
Each of the per-lang overwrites will fall back to
--jf-font-override
if not overridden, and--jf-font-override
will fall back to Noto Sans if not overriden.When wanting to use
font-family
anywhere in the code base, one would reference the--jf-current-font
variable to retrieve the current effective font, overridden or not.A
jf
prefix has been added to the vars to avoid clashes with user themes.