I've heard this punch from many people who hate (don't know how to use) Tailwind - that it can't be used on a "themeable project", thanks for myth-busting this argument!
@rfmiotto3 жыл бұрын
I was running into this just a couple days ago! What a perfect timing for this tutorial. Thank you Tailwind Labs for these videos. Please, keep coming up with high-quality materials like this.
@Сергей-й9т7ъ2 жыл бұрын
Exploring tailwind and had thoughts few days ago: "How can I use css variables for themes" And today video appeared. Magic! Thanks KZbin and you guys! Awesome!
@protocode_2272 жыл бұрын
it's spooky sometimes, right 😄
@Andrey-il8rh3 жыл бұрын
I really like how flexible it is to style not only the full root document but each component individually. I already see how those variables can even be scoped inside the component itself to provide completely different styling rules for each individual component and not only colors, it basically allows for turning Tailwind into an ultimate utility-meta framework where classes become meta-information for a possible look. Requires a bit of a mental stretch in the beginning but gives ultimate powers!
@elie14003 жыл бұрын
A list of your vscode extensions would be appreciated
@DaniloMarquesdeRezende3 жыл бұрын
Agreed
@eYinka3 жыл бұрын
Honestly +1
@corey59743 жыл бұрын
I believe the one that highlights the css colors is a plugin called Color Hight (naumovs.color-highlight) by Sergii Naumov
@DanielDrummond2k63 жыл бұрын
Any one know how extension to convert color Hex to RGBA and vise versa?
@elie14003 жыл бұрын
@@DanielDrummond2k6 hex-to-rgba by dakshmiglani
@_CazaBobos2 жыл бұрын
I've been looking for this for very long. Thanks! It works amazingly with Next.js SSG Just a little trick: instead of asking if opacityValue is undefined, you can use a nullish coalescence operator to assign a default value when it's null or undefinded. Example... ${ opacityvalue ?? 1 }
@wolfphantom3 жыл бұрын
The return value could be streamlined as an implicit return, but I would at least set the default @ 22:00 with ({ opacityValue = 1 }) rather than setting a guard check
@LorenzoLeonardini3 жыл бұрын
I have the feeling (but I could be totally wrong) that opacityValue is not the value itself but the name of the CSS variable for the opacity (--tw-bg-opacity)
@yakovlev_io2 жыл бұрын
@@LorenzoLeonardini you are right, it’s an object destruction syntax { … }
@yashkhd11003 жыл бұрын
I think your method is best one for implementing dynamic theming with tailwind CSS. I have seen bunch of other approaches but by far this one is cleanest one.
@faraonch Жыл бұрын
Fantastic demo! You could consider setting the default transparency value to 1 in function arg where you deconstruct the opacity value to avoid the if statement in the withOpacity.
@oliverp80063 жыл бұрын
Great one, would be nice to have a follow up part about the best way to add/implement dark mode to the theming
@hoagy_ytfc3 жыл бұрын
Yes!
@addd3231 Жыл бұрын
Very helpful tutorial, few days ago I tried to build my app with custom theme colors, but this is more useful 🤯
@friemae3 жыл бұрын
These videos are really excellent, awesome developer experience!
@ulvidamirli27583 жыл бұрын
Perfect tutorial and that’s what I was looking for. Out of topic, but it would be perfect to see web design tutorials from you
@Allformyequine3 жыл бұрын
... and that is it!! LOL Fantastic and you sometimes make me laugh a little which is a giant bonus; Tailwind really has a gem with you and the way you do these videos! How long did they look to find a coder that is ALSO great in front of a camera lol! Rock on!
@QueeeeenZ3 жыл бұрын
Perfect, this is exactly what I was looking for! I thought it was not possible to do themes with Tailwind.
@benthomson24063 жыл бұрын
your guys make tailwind CSS custom feature amazing!
@aleksandervitalevich12997 ай бұрын
«Лёгким движением руки брюки превращаются… брюки превращаются… превращаются брюки… в элегантные шорты!» 👍👍👍
@dealloc3 жыл бұрын
I would just specify colors for specific states in the theme without the hassle of support bg-opacity, etc. It may seem odd, but if the idea is to give control to the theme of defining colors, then it makes more sense that it also controls the opacity. There are cases where you want to use a different opacity based on the contrast, as color is perceived differently based on the background and foreground contrast and the opacity will look lighter/darker depending on this. This is also why dark themes aren't simply just inverting the colors; contrast matters.
@weblearningd22942 жыл бұрын
I can not stop watching your videos, really great!! Thanks a lot!
@markconger80493 жыл бұрын
Should my brain hurt after watching this? LOL It does. I’m sure I’ll have to watch this series a couple of times through since my CSS skills are so-so. But, that said, I’m very impressed so far with Tailwind’s approach. It seems now we finally have CSS that is a programming language than whatever it was previously.
@alfaphil3 жыл бұрын
Thank you from France, your video is a game changer for me :)
@lightningspeed64663 жыл бұрын
Thanks it was really helpfull Was trying to figure it out for a long time
@zeroows3 жыл бұрын
Great work, Thank you. 27:05 where did the fly came from :)
@Andrey-il8rh3 жыл бұрын
Just a small suggestion to make check inside withOpacity more succinct, you can just check for undefined like so opacityValue ?? 1 that way if it will be undefined it will default to 1, note that I'm using nullish coalescing operator here to support 0 values. It's natively supported in Node since v.14
@rijkvanwel3 жыл бұрын
@18:56 Couldn't you just use Tailwind's opacity variable? Like so: 'muted': rgba( var( ---color-text-muted ), var( --tw-text-opacity, 1 ) ) Just tested and that seems to work fine! Way easier than the function.
@Mike-lu1pt3 жыл бұрын
I was wondering why he didn't just do that, but I think it's because the opacity variable is different for different properties. Right?
@daffamumtaz23612 жыл бұрын
1. To make sure your code won't break when the variable name changes 2. To reset the opacity value. Notice the generated class adding "--tw-text-opacity: 1" above. Without resetting, any bg-opacity class in the parent would persist.
@reapi_com2 жыл бұрын
then you're locked down with the hardcoded classname --tw. what if next version they decide to use --tw4-text-opacity?
@akamfoad3 жыл бұрын
Will use this video as inspiration to theme my website soon, thanks for the great explanation and approach as always
@JimOHalloran3 жыл бұрын
Kinda feels like with naming colours you're getting back into some of the "naming is hard" territory that utilities were meant to solve for us. But I don't see any other way around it. I'm working on my first Tailwind application at the moment which will eventually be forked off and used as the basis for many other apps. How the follow on apps get re-coloured without a massive search and replace to change a whole bunch of utilities was on my mind, so this is well timed.
@vesper83 жыл бұрын
Amazing video! It would really helpful if you could share a gist or repo with the code too... also would love it if you could name a few of the plugins you're using on vscode.. notably the css preview when you hover a class and the one that highlights colors with their actual color. Many thanks!!
@SusanthCom3 жыл бұрын
Thank you so much ❤️ for this wonderful tutorial. Would love to see more possibilities of theming. Hope we can control more looks like, border radius, background image, polygon shapes, different svg based on theme. It will bring great change in looks apart from colour alone. 👍👍 Keep rocking.
@parenteseswebdev3 ай бұрын
Would you know a problem that i have. I used tailwind cli to make a website using the stock install procedures. The website looks and functions fine in local vsc dev, but when i upload to server to the htdocs folder all the html files and the output.css, the styling isn't applied. Could you advise.
@TobiasSailer3 жыл бұрын
Curious: is this vscode preview plugin public? Can't find it!
@MikeStratton3 жыл бұрын
You make it look insanely easy. wait, maybe it is that easy!
@tonyemmanuel80454 ай бұрын
How about adding spacing like padding to the skin? Is there any specif group name required for that skin ?
@ryanross71913 жыл бұрын
at 22:07 (guarding against undefined) you should be able to avoid blocks entirely by using a ternary in your interpolation like so: ${ opacityValue !== undefined ? opacityValue : 1 } ... and even simpler, since opacity:0 is unlikely, like so: ${ opacityValue || 1 } (taking advantage of truthiness, even though 0 is a possible but unlikely input since it would be a strange way to specify invisibility. 🤦🏻♂️)
@nasim67783 жыл бұрын
thanks you're solve my problem , I did not put an equal operator
@dealloc3 жыл бұрын
Just do this: ({ opacityValue = 1 }) => { ... }, problem solved. No need for ternaries or short circuits.
@jimmyj.67923 жыл бұрын
So awesome 😍😍😍 simple as well with a great quality and some magic final tricks 😁👌🎉🎉
@palyanytsia3 жыл бұрын
What's the plugin you are to preview colors in css?
@tilakmadichettitheappdeveloper3 жыл бұрын
good question ! its in the internet.
@raymondmichael49872 жыл бұрын
This looks heavy and good to be done
@subhashmalireddy3 ай бұрын
WOW 🤯 and thank you. I'm pretty new to tailwind, is the theming config especially the stuff related to opacity still relevant(I'm guessing YES, but still wanted to confirm)?
@adrian13585 ай бұрын
Great stuff, a lot of useful info, thank you 😊
@thomassaw11 ай бұрын
Thank you so much for this video. Learned a lot!
@adamtak31283 жыл бұрын
Is this the theming strategy you suggest we use with the new JIT compiler in tailwindcss?
@devhamdani Жыл бұрын
Can you tell me that which fonts you're using for your editor. I really love it.
@techie6073 жыл бұрын
I am trying to implement tailwind css struggling a lot but feeling confident as well
@razafindrakotojosephin6151Ай бұрын
i'm quite new to tailwind. Using the withOpacity utility function on typescript doesn't work. How can we implement such utility function for ts?
@VincentCordel Жыл бұрын
Great tutorial thank you! Quick question: is it possible to use the default tailwind colour palette in the css variables instead of the hex/rgb hardcoded values? In other words, something like: -colour-primary: Colors.red.700 Instead of -colour-primary: rgb(255,179,255)
@myxsys2 жыл бұрын
The opacity function doesn't work in Tailwind CSS v3.0.24. However, returning `var(${variableName})` works without wrapping `rgb` or `rgba`
@harrygreen1465 Жыл бұрын
Great video, thanks! It's a little outdated I think, as you can now define hex colours inside the tailwind config `theme`, and opacity variants will work without needing to add the logic yourself.
@markokraljevic15902 жыл бұрын
but what if i want to reuse colors from the palette like --accent-medium: theme('colors.pink.700'); and not hardcoding rgb values? theme('colors.pink.700') is hex value and I need to convert to rgb somewhere
@neelabhdutta66913 жыл бұрын
I am thinking of using it to implement light/dark theme on user selection, so, do I have to change the wrapper class conditionally or dark:my-wrapper would work just like usual html with dark class ???
@jnetto3 жыл бұрын
Best teacher ever! Thanks for this tutorial!
@codementor39742 жыл бұрын
i have a problem ,if we set opacity-x for bg-theme-x not only bg opaicty changed even text opacity turn chnaged , what to do in this situation please guide
@joeregan.3 жыл бұрын
Why doesn't tailwind include classes like primary by default like other popular frameworks like bootstrap and uikit?
@iamdavidwparker3 жыл бұрын
I implemented multiple themes on a site of mine last year. 12 themes light + dark mode. It was super simple, though I _think_ this may be even easier. Can't wait to try it out! Note: not sure why my last comment was deleted? Due to link?
@TailwindLabs3 жыл бұрын
Not sure either, I did see the notification email though originally! We didn’t delete it, must be a KZbin thing probably link related like you said 🤔
@iamdavidwparker3 жыл бұрын
@@TailwindLabs probably. Not worried about it. Thanks for the video, the timing is perfect.
@SusanthCom3 жыл бұрын
Could you please share your implementation. Would like to learn more about theming ❤️ Thanks 👍in advance
@SusanthCom3 жыл бұрын
@david Parker ❤️❤️
@divdax42863 жыл бұрын
Love your videos and tailwindcss!
@valtism3 жыл бұрын
The microphone is so big 🤣 Thanks for the content as always!
@sanctipaprichio3 жыл бұрын
I always more appreciate good voice quality than a cam!
@dorshiff2 жыл бұрын
When it came to typography, there are some needed changes in different screen sizes, how do you define them in this method?
@JohnSmith-zl8rz3 жыл бұрын
You only use textColor and backgroundColor, so I need go to each tailwind config and add those again, like "divideColor", "caretColor" etc. ???
@lenartpapez25123 жыл бұрын
This looks amazing, but I can't seem to get it to work in a new Angular project (v11.2). Neither with CSS or SCSS. Any news on that?
@g-luu3 жыл бұрын
did you manage to get it working? seems to work on development but not in production
@Katre-25 күн бұрын
How use color from tailwind.config.js ? With theme() function ?
@zeeeeeman8 ай бұрын
All that function nonsense is no longer needed now. You can just use hex values if you wish. Example: bg-skin-base/10 for 10% opacity on the base background color. Wonderful improvements since 2021.
@kieran57466 ай бұрын
Thanks for confirming that. I was just about to test the same.
@MD-kb8zt6 ай бұрын
I tried this and seems to still not be working. Do I need to define something in the globals.css or tailwind config?
@kieran57466 ай бұрын
@@MD-kb8zt I did not get around to trying this out at the time. After reading your comment this morning I went and implemented it and I can confirm that / opacities etc do not work by default with the latest version of Tailwind. @zeeeeeman can you confirm this is actually working for you? If so, would you mind sharing your configurtation?
@MD-kb8zt6 ай бұрын
@@kieran5746 I found a solution. Look for “Customizing Colors” in the tailwind documentation then ctrl f to find “”alpha-value” and it goes over how to define your variables to use the method listed in the original comment
@kieran57466 ай бұрын
@@MD-kb8zt Thank you so much for updating your comment with a solution. I am not currently at a PC but I will try this ASAP. Thanks again!
@Diamonddrake3 жыл бұрын
Tailwind is love, tailwind is life.
@lcapocer3 жыл бұрын
When I use Vue-Cli and run a build only the :root theme is inside the generated css file, why is that?
@magnusandersson24953 жыл бұрын
Why split and convert the hex code to rgb values in your with opacity function instead of using the vscode plug-in? Javascript has parseint-function that can do this.
@chaes11613 жыл бұрын
Great! Is there any way to enable color preview using this approach?
@huannguyen65592 жыл бұрын
You can still use rgb(0,0,0,1) in your css file for color preview but need to remove "rgb" and "alpha" in the "withOpacity" function
@brianzitzow44113 жыл бұрын
Any reason you are using CSS Custom Properties rather than plugins that add the utilities and use theme properties with the values defined directly in the theme?
@visheshmp10 ай бұрын
14:40 thats amazing!!!!!!!!!!
@jasarwadlow94063 жыл бұрын
Neat! Great video, it's well-explained and very easy to understand. Thanks! I have a question: can we use any existing tailwind colors (ie, text/bg-red-500)? Using the approach in the video, it looks like the same color may be redefined multiple times. aka, is it possible to create something like an Alias Token? Or is the only way to do this via the tailwind config (where we have access to the colors)?
@jasarwadlow94063 жыл бұрын
nvm, I think I found how: --color-fill: theme('colors.red.700');
@chethannp5981 Жыл бұрын
The best tutorial ❤
@ahmedosama76323 жыл бұрын
Make a video on RTL with tailwind
@CodeFusionDev4 ай бұрын
Kindly use latest tailwind css v3.4.* in adding opacity to color
@VuNguyen-yj5wi3 жыл бұрын
Thank you so much! It's so useful ❤️
@helloiamjoshie3 жыл бұрын
How would one go about setting up border colors this way?
@JohnSmith-zl8rz3 жыл бұрын
text-skin-base is confusing, sounds very close to text-base (size), what about text-skin-content ?
@JustinByrne13373 жыл бұрын
Does anyone know how to get that preview panel in VSCode I can't find one that looks that good
@QWERTY-mh2hb Жыл бұрын
It's possible to do this with React Native?
@FauzulChowdhury3 жыл бұрын
Superb content. 👏👏👏
@kohelet9102 жыл бұрын
Using JS functions into CSS.. so cool
@Levyndra Жыл бұрын
With new TS config it's problematically to implement such function like ({opacity}) => `blabla` to "colors" section
@nmastroianni Жыл бұрын
I am getting TypeScript errors for the withOpacity function that make me nuts. I had to use a return type of "any" which makes me squirm a little.
@eidiazcas2 ай бұрын
I completely agree with the concept, but the css-variables suck because of type safety, I wish there was a way to enforce your themes to have the same variables
@ShinjaeKang3 жыл бұрын
Good tutorials, Thank you very much :)
@ray-lee3 жыл бұрын
how about dark theme? is it just dark:theme-name?
@mkroven3 жыл бұрын
Thank u. Wonderful explanation.
@Svish_3 жыл бұрын
Any reason one you couldn't/shouldn't just define the theme colors as `rgba` and use the text-opacity thing directly? So instead of `--color-fill: 185, 28, 28;` and that `withOpacity` function, just do `--color-fill: rgba(185, 28, 28, var(--tw-text-opacity));`? Not sure I understand what the `opacityValue` and helper function you made does "more", and feel like I'm missing something here. 🤔
@TailwindLabs3 жыл бұрын
Then if you used it for a background color it would adopt the text opacity instead of the background opacity. The variable name changes depending on how the color is used, for example: That uses two different opacity variables, so if you bake it right into the color one of the won't work.
@Svish_3 жыл бұрын
@@TailwindLabs Aaaah! Knew there had to be something I was missing. Thank you for quick reply! Started using Tailwind for the first time last week on a new side-project of mine and I'm LOVING IT 💙
@rodrigorios783 жыл бұрын
I like how his accent is easily understandable... cool feature btw!
@pipe_runner_lab2 жыл бұрын
At this point, TW is not adding on top of CSS, but becoming a language of its own. Something many devs won't welcome. This is an unnecessary complexity. Good for prototyping and all, but not sure if this is something I would like in my final product.
@ulrichmbouna40913 жыл бұрын
About new tailwindcss/jit , i have problemes with postcss 8 in vue 3 project , how can i do please?
@macbruker3 жыл бұрын
Try searching for a similar issue in the tailwindcss/jit github repo. If you don't find an existing issue, you can add one of your own. It could be that you are missing the NODE_ENV=development variable. Instructions for this is in the readme file in the repo.
@hcsftw3 жыл бұрын
Thank you! Could you provide the code somewhere?
@benjaminmaywald6608 ай бұрын
Thanks for the whole Playlist ...your microphone is getting bigger with every video ;-)
@bryanprimus3 жыл бұрын
what font that you use for your vs code font ?
@josephocampo49682 жыл бұрын
looks like dank mono
@protocode_2272 жыл бұрын
is this still the way to go? I guess since it's over a year ago, there might be a nice approach, so don't have to use this 'unsupported' rgb format . . ?
@MrTrickydisco3 жыл бұрын
Any chance you could share the code on play.tailwind?
@electrotsmishar2 жыл бұрын
Thank you. Great tutorial
@agnemedia6243 жыл бұрын
Thanks for tips, tricks and technics Wow
@sushardianto80393 жыл бұрын
Thank you. Please, share the code link
@lucioeiras3 жыл бұрын
What is your VSCode theme?
@evanfuture3 жыл бұрын
Amazing, I love it.
@bluemelon-io3 жыл бұрын
What a masterpiece!
@CorporalPoon2 жыл бұрын
a shame you have to lose the color indicator in VS Code when you change hex to just raw value.
@TheWebIsYourFriend2 жыл бұрын
You could define colors as rgb and use a utility class in the js to add the alpha. I do something like this: const rgbAddAlpha = (rgb: string, alpha: number) => { rgb = rgb.slice(rgb.indexOf("(") + 1, rgb.indexOf(")")); return `rgba(${rgb}, ${alpha})`; };
@cintron3d3 жыл бұрын
Was wondering about how this would be done for building a light/dark theme. Thanks! Really breaking away from IE here as it doesn't support css variables anywhere except in the root. I love this design though and hope my company can ditch IE soon.
@JustinByrne13373 жыл бұрын
Tailwind actually has a dark mode, check out the docs and you can implement with that
@ManadayMavani3 жыл бұрын
You can try using "prefers-color-scheme" media query for the dark theme preference. Set the :root selector to the dark color palette inside the media query. Except IE11 all browsers support it so they'll switch to dark theme if the user has set his/her preference for the dark theme. IE11 will ignore it and will use your default color palette.