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
  • Наука та технологія

КОМЕНТАРІ • 28

  • @Alipakdamany
    @Alipakdamany 5 місяців тому +6

    got a headache watching videos on this topic for hours understanding nothing, very clear and straight to the point🔥

  • @BooksWeCanRead
    @BooksWeCanRead 7 місяців тому +7

    Very very cool!! I love how you explain things! No faff just straight to exactly what’s needed! 👏👏✨

  • @rog0079
    @rog0079 7 місяців тому +2

    so useful stuff in such a short video

  • @xiaodhruv7693
    @xiaodhruv7693 7 місяців тому +1

    Wow never thought this would be this easy TT, thankyou very much

  • @ricardocnn
    @ricardocnn 6 місяців тому +1

    Awesome approach!

  • @digitalsahara6670
    @digitalsahara6670 7 місяців тому +1

    wow that is explained so well and straight to the point, hoping you have a full on course coming out soon ...

    • @tomisloading
      @tomisloading  7 місяців тому +1

      I will absolutely do a full length tailwind vid soon :)

  • @mohamedyamani8502
    @mohamedyamani8502 7 місяців тому +1

    Pretty cool man! Great video.

  • @joshuaheathcote2116
    @joshuaheathcote2116 4 місяці тому +1

    Thank you Tom

  • @madie2659
    @madie2659 7 місяців тому +1

    Loved it thanks

  • @redders6600
    @redders6600 7 місяців тому +4

    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!

    • @tomisloading
      @tomisloading  7 місяців тому +1

      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 😁

  • @whyyshivam
    @whyyshivam Місяць тому +1

    So Good, that I wanna recreate this 🤧

  • @yaronp16
    @yaronp16 5 місяців тому +1

    thanks you helped a lot!

  • @raybelmo
    @raybelmo 3 місяці тому +1

    Cool!

  • @DMZT_dhruv
    @DMZT_dhruv 6 місяців тому +1

    I watched this video long ago, I though I saw this in instagram 😅, but I finally founded here hehe

  • @user-vp5wr2tx9i
    @user-vp5wr2tx9i Місяць тому +1

    You're a fucking legend.

  • @feelsthevibes1662
    @feelsthevibes1662 7 місяців тому +1

    if u use this
    primary: 'rgba(var(--color-primary), )',
    than opacity will work

  • @NitinKumar-jc7bg
    @NitinKumar-jc7bg 7 місяців тому +1

    How to get the rgba numbers for dark theme and light theme like you have is there any website ?
    By the way awesome video ❤👌

    • @tomisloading
      @tomisloading  7 місяців тому +1

      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 :)

  • @LulsegedAdmasu
    @LulsegedAdmasu 2 місяці тому +1

    wow

  • @amirreza3638
    @amirreza3638 4 місяці тому

    What about colors with intensity? Like blue-400 ?

  • @Ancode2
    @Ancode2 2 місяці тому +1

    How simple and useful. Thank you very much for this