How to change style inside a component, for example Card component? #84
-
Hi @satnaing , how are you? I tried to change the style of the Card component using a different background color for each mode, light and dark, but I could not get it work. Only the light color is shown, no matter in which mode I am. Card
By the way, which is the difference of using a TypeScript for Card component instead of an Astro. Thanks in advance !! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I've used CSS variables for the entire theming 😬. This approach has some benefits. First of all, we can use more than two themes if we want. Second, we don't have to define styles for dark themes and light themes for each element. Method 1: Define custom class in the global style
|
Beta Was this translation helpful? Give feedback.
-
Thank @satnaing ! That's why was not working when I was changing through Tailwind haha, I got crazy! Now is working, I used method one ❤️ |
Beta Was this translation helpful? Give feedback.
I've used CSS variables for the entire theming 😬.
This approach has some benefits. First of all, we can use more than two themes if we want. Second, we don't have to define styles for dark themes and light themes for each element.
On the other hand, it has some trade-offs. We can no longer use Tailwind's
dark
variant. To solve this issue, we can do the following approaches.Method 1: Define custom class in the global style
base.css
fileThen …