-
-
Notifications
You must be signed in to change notification settings - Fork 596
[6.x] Refactor CSS color variables #13008
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
[6.x] Refactor CSS color variables #13008
Conversation
|
I like the idea but I don't think Tailwind will parse these variables when do you this. 🤔 |
|
@jackmcdade Works fine. Initially it didn't but I figured it out with one of the last commits. Gave it some thorough testing and couldn't find any problems so far. But if this will eventually be merged I'd appreciate some more eyes in case I haven't found all occurrences of the classes that aren't needed anymore. The idea was to not overcomplicate the dark mode with additional classes and make all variables configurable, dark and light. |
|
Okay cool, I'll have a tinker and see what I can find. I also had this possible angle to make "themes" just CSS files and maybe get rid of the config thing entirely. #12947 Not sure how this would play nicely with that, but I was on the fence w/ that one anyway. |
|
I think both can work together. In the end we still print out native CSS with this config. Only difference with this PR is, that we override the CSS variables for dark mode when dark mode is active. Take a look at the head partial for reference, it's still pure CSS with less CSS variables. I'd still fancy your file approach for more sophisticated theming if one is in the need. That would give anyone ultimate theming capabilities 😆 |
JayGeorge
left a comment
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.
This all looks good to me, thanks for your work on this, Andreas :). I've played around with it and it's all working OK with the dark overrides.
While playing with the different hues I noticed some stray hard coded gray values so I fixed those.
|
Fixes #13027 |
# Conflicts: # src/CP/Color.php
# Conflicts: # src/CP/Color.php
|
@jasonvarga If we want to make the newly added |
I've adjusted the logic so adding a |
This PR refactors how the theming works in regards to light and dark variants.
Instead of creating dark theme CSS classes, the default (light-mode) CSS theme classes are overridden within
:rootwhen dark mode is active.This allows to introduce dark mode variants for all color config options, simply by prepending
dark-in front of them without needing to introduce adark-somethingclass on a component.For example: Till now you could only set a
primarycolor or allgraysglobally. Now you can set different colors for the modes:Before:
After: