-
Notifications
You must be signed in to change notification settings - Fork 146
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
Separate :root, light-theme and dark-theme styles. #8295
base: master
Are you sure you want to change the base?
Conversation
/cc @parlough too, not sure why I couldn't add you as a reviewer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what if we ever need variables that are specific to dark or light mode?
(I don't mind tests enforcing this structure, but they should provide a good message when the fail, so that you don't have to figure out what the test does first).
I see value in trying this out, as the thought of forgetting to define a corresponding dark mode color did cross my mind. The one downside is that there is no fallback if the class is somehow missing, so tests should likely also make sure each page is rendered with one of the classes added. |
Not sure how that would work, maybe those should be in shared?
Yes, this is a good point. I will add this test to this PR and add further tests for the variable splits as a separate PR. |
An alternative idea: we could keep the :root rule, but still separate the variables into two groups: one that is checked that they should have a matching dark-theme variant, and the other that is checked that they don't have further overrides. It could provide the value of having tests and separation, but still doing a good fallback in case we miss something. |
15b2a10
to
7ed8142
Compare
:root
and.light-theme
.:root
, and override them under.dark-theme
. I think it may be worth considering the separation of:root
to have only shared variables that are not redefined in later scopes, and the two theme have variables that are in both scopes.