The Best Way to Handle Dark Mode with TailwindCSS
Вставка
- Опубліковано 30 чер 2024
- Animated UI components for React, Tailwind CSS, Framer Motion & More ✨ www.hover.dev
Theming your website, wether just to allow light and dark mode, or even to allow full customization of the look and feel for your users, is a great (and often expected) way to increase user experience.
Today we'll take a look at how we can achieve this in TailwindCSS utilizing CSS variables. We'll use ReactJS for our example, but everything will apply exactly the same for HTML, CSS & JS, Svelte, Vue, or any other framework.
📚 Project Links
Source: github.com/TomIsLoading/tailw...
🔗 My Links
TikTok: / tomisloading
Instagram: / tomisloading
GitHub: github.com/TomIsLoading
Twitter: / tomisloading
Discord & more: linktr.ee/tomisloading
Portfolio templates: tomisloading.gumroad.com/
Website: www.hover.dev
0:00 - Intro to theming in TailwindCSS
0:36 - Defining colors in your tailwind config
0:56 - Using CSS variables
1:41 - Refactor our example
2:05 - Adding more themes
2:44 - Switching themes based on OS preferences & more - Наука та технологія
got a headache watching videos on this topic for hours understanding nothing, very clear and straight to the point🔥
Very very cool!! I love how you explain things! No faff just straight to exactly what’s needed! 👏👏✨
so useful stuff in such a short video
Thank you!! :D
Wow never thought this would be this easy TT, thankyou very much
Awesome approach!
wow that is explained so well and straight to the point, hoping you have a full on course coming out soon ...
I will absolutely do a full length tailwind vid soon :)
Pretty cool man! Great video.
Thank you!! 😁
Thank you Tom
Loved it thanks
Happy i can help! :)
This is the easy bit...! The challenge is getting colour palettes that work well together and using the right colours in the right places... It gets _really_ confusing!
Funny enough, I’m building a free tool to help with this literally right now 😂😂 there’s a few good ones (Real Time Colors by Juxtopposed is awesome) but I’m building something a bit simpler and more developer focused 😁
So Good, that I wanna recreate this 🤧
thanks you helped a lot!
Happy I could help :)
Cool!
I watched this video long ago, I though I saw this in instagram 😅, but I finally founded here hehe
You're a fucking legend.
😎
if u use this
primary: 'rgba(var(--color-primary), )',
than opacity will work
How to get the rgba numbers for dark theme and light theme like you have is there any website ?
By the way awesome video ❤👌
So for this video, I just grabbed some colors from the tailwind site :)
There's a bunch of different color generators out there, and I'm actually building my own right now haha. If you check back in a week or so on my site you should see that :)
wow
What about colors with intensity? Like blue-400 ?
How simple and useful. Thank you very much for this