Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

Use CSS relative color syntax to darken/lighten colors for borders, backgrounds, etc. 🔥 .success { --c: green; } aside { background: oklch(from var(--c) calc(l * 0.75) c h / 0.5); color: oklch(from var(--c) calc(l * 1.5) c h); } Magic! ✨

256,442 görüntüleme • 2 yıl önce •via X (Twitter)

10 Yorum

jhey ▲🐻🎈 profil fotoğrafı
jhey ▲🐻🎈2 yıl önce

Here's the @CodePen link! 🚀 Firefox doesn't support relative color syntax... yet. You can get a similar behavior using color-mix though! 🔥 aside { background: color-mix( in oklch, var(--c) 50%, oklch(0% 0 0 / 50%) ); }

Igor bedesqui profil fotoğrafı
Igor bedesqui2 yıl önce

holy shit this is so much easier than the manual alternative of having a variant for each scale

jhey ▲🐻🎈 profil fotoğrafı
jhey ▲🐻🎈2 yıl önce

Totally! 💯 This one was quickly thrown together too so its a little rough around the edges 😅 The technique holds though 🙌 Definitely gonna spend some more time with it for some upcoming projects

Charlie Joseph profil fotoğrafı
Charlie Joseph2 yıl önce

This.. combined with Tailwind v4 variables will be superb 👌 Thanks for sharing such a clever method

jhey ▲🐻🎈 profil fotoğrafı
jhey ▲🐻🎈2 yıl önce

Oh yes! Magical ✨💯 Firefox doesn't support the relative color syntax yet. But does support color-mix which allows you to create a pretty similar set of behaviors 🙌

Tycho Tatitscheff profil fotoğrafı
Tycho Tatitscheff2 yıl önce

Oklch is so good for this use case cc @CipolleschiR @jamonholmgren

Jake Vollkommer profil fotoğrafı
Jake Vollkommer2 yıl önce

Someone drop the tailwind

楷鹏Dev profil fotoğrafı
楷鹏Dev2 yıl önce

Hey, bro. Can you tell me how you made this smooth video?

Tim Wilson profil fotoğrafı
Tim Wilson2 yıl önce

Very nice 👌

Pavee Udomkarnpaisarn profil fotoğrafı
Pavee Udomkarnpaisarn2 yıl önce

This is neat!

Benzer Videolar

L I C H A 😤
0:20

Sensitive content

L I C H A 😤

Manchester United

301,034 görüntüleme • 8 ay önce