Is there even a way to use data-theme with stylus? #2823
-
I spent 6 hours looking for the correct way to make this with stylus, but I didn't got any good idea: :root {
--main: #0f0f0f;
--letter: snow;
}
[data-theme="light"] {
--main: snow;
--letter: black;
} All I want is to set 2 themes, but there's no examples of this on internet, neither stylus documentation, I have also check discussion here, but there's not information neither |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
wrong stylus repo |
Beta Was this translation helpful? Give feedback.
-
It sounds like you might be thinking about this the wrong way. Stylus variables are for compile-time values. CSS custom properties are for runtime values. They have different purposes are aren't interchangeable. If you just want to replace :root
--someColor snow
someVar = var(--someColor)
.someClass
color someVar |
Beta Was this translation helpful? Give feedback.
It sounds like you might be thinking about this the wrong way. Stylus variables are for compile-time values. CSS custom properties are for runtime values. They have different purposes are aren't interchangeable.
If you just want to replace
var(--someColor)
withsomeVar
in your code, you can literally just do this: