[3.0] Load the stylesheet a theme variant is recoloured with - #9669
Open
albertlast wants to merge 1 commit into
Open
albertlast wants to merge 1 commit into
albertlast wants to merge 1 commit into
Conversation
A theme has two ways to recolour a variant. One is a single variants.css holding :root[data-variant="..."] blocks, which loadVariant() already loads. The other is a whole stylesheet per variant, sitting on top of index.css, which the default theme documents in index.template.php: Define the theme variants. Each variant has its own CSS file. Example: - index_red.css is loaded when the user selects the `red` variant. Nothing loaded it. The file goes in at order_pos 2, after index.css and beside dark.css, so it overrides the base sheet. The 'default' variant is the base sheet by itself and has no file to load; for any other variant the file is validated before it is queued, so a theme that recolours through variants.css instead is unaffected. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
A theme has two ways to recolour a variant, and
Theme::loadVariant()only implements one of them.The first is a single
variants.cssholding:root[data-variant="…"]blocks. That one is loaded.The second is a whole stylesheet per variant sitting on top of
index.css. The default theme documents it inindex.template.php, right above the setting that declares the variants:and again further down:
Nothing loaded them. This adds it.
Details
order_posis 2 — afterindex.cssat 1 and besidedark.css, so the variant sheet overrides the base sheet, which is the point of it.defaultvariant is the base sheet on its own, so it has no file and is skipped.loadCSSFile()validates by default, so a theme that recolours throughvariants.cssinstead simply has nothing queued. Adding this cannot break such a theme.Verification
Declaring a
sunsetvariant in the default theme locally, all three cases on a running forum with nothing added tolog_errors:index_sunset.csspresent,?variant=sunsetindex_sunset.cssabsent,?variant=sunsetindex_default.csspresent,?variant=defaultIssues References (Fixes|Related|Closes)
Related to #7933.
🤖 Generated with Claude Code