Skip to content

Instantly share code, notes, and snippets.

View LeaVerou's full-sized avatar

Lea Verou LeaVerou

View GitHub Profile
@LeaVerou
LeaVerou / dabblet.css
Created March 27, 2021 23:21
LCH vs HSL colors for the same lightness
/**
* LCH vs HSL colors for the same lightness
*/
div {
width: 100%;
height: 6em;
background: linear-gradient(to right, var(--stops));
--stops: gray, gray;
--l: 50%;
@LeaVerou
LeaVerou / dabblet.css
Created March 4, 2021 14:33
Extrapolation
/**
* Extrapolation
*/
@keyframes funky {
to {
background: gray;
}
}

Lightness/darkness adjustments

How to lighten/darken

let color = new Color("hsl(20, 100%, 30%)");

// HSL lightness adjustment
let lighter = color.clone();
@LeaVerou
LeaVerou / dabblet.css
Created February 15, 2021 16:18
HSL problems
/**
* HSL problems
*/
body, div {
display: grid;
grid-template-columns: 1fr 1fr;
}
div {
@LeaVerou
LeaVerou / dabblet.css
Created February 10, 2021 08:05
Providing color suggestions
/**
* Providing color suggestions
*/
@LeaVerou
LeaVerou / dabblet.css
Created January 28, 2021 12:15
Selector lists in :not()
/**
* Selector lists in :not()
*/
body {
background: red;
}
body:not(#a, .b, c) {
background: green;
@LeaVerou
LeaVerou / dabblet.css
Created January 28, 2021 11:51
Complex selectors inside :not()
/**
* Complex selectors inside :not()
*/
body {
background: red;
}
body:not(#foo .bar) {
background: green;
@LeaVerou
LeaVerou / dabblet.css
Created January 26, 2021 08:27
orientation MQ
/**
* orientation MQ
*/
@media (orientation: portrait) {
body {
background: green;
}
}
@LeaVerou
LeaVerou / dabblet.css
Last active January 18, 2021 15:11
var() and fallback
/**
* var() and fallback
*/
--initial: initial;
background: var(--initial, green); /* fallback applied */
@LeaVerou
LeaVerou / dabblet.css
Created January 15, 2021 15:51
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
template {
display: block;
background: yellow;
width: 100px;
height: 100px;
}