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
Last active April 24, 2024 17:40
Polar interpolation discontinuity
/**
* Polar interpolation discontinuity
*/
div:nth-of-type(1) {
background: linear-gradient(to right in oklch, oklch(70% 0.1 0), oklch(70% 0.1 180));
}
div:nth-of-type(2) {
background: linear-gradient(to right in oklch, oklch(70% 0.1 0), oklch(70% 0.1 179));
@LeaVerou
LeaVerou / dabblet.css
Last active April 24, 2024 17:41
Polar interpolation issues
/**
* Polar interpolation issues
*/
div {
padding: 2em;
flex: 1;
}
div:nth-of-type(1) {
@LeaVerou
LeaVerou / dabblet.css
Last active April 24, 2024 17:31
none-containing values as intermediate stops
/**
* none-containing values as intermediate stops
*/
div:nth-of-type(1) {
background: linear-gradient(to right in oklch, oklch(80% 0.1 0), oklch(80% 0.1 170));
}
div:nth-of-type(2) {
background: linear-gradient(to right in oklch, oklch(80% 0.1 0), oklch(50% none none), oklch(80% 0.1 170));

Custom coord types

let turquoise = new Color("oklch(.7 .1 180)");

// Custom functional format:
turquoise.toString({format: {
	name: "oklch",
	coords: [
@LeaVerou
LeaVerou / dabblet.css
Created November 29, 2023 18:26
keyword + <percentage> in <position>
/**
* keyword + <percentage> in <position>
*/
background: linear-gradient(45deg, #f06, yellow) no-repeat left 10% / 1em 1em;
min-height: 100vh;
@LeaVerou
LeaVerou / dabblet.css
Last active October 9, 2023 01:48
none keyword test
/**
* none keyword test
* Pass: There should be no red, nor any distinct squares
*/
html {
background: red; /* if you see this, the none keyword is not supported */
background: color-mix(in hsl, hsl(80 50% 90%) 0%, hsl(none none 50%));
}
@LeaVerou
LeaVerou / dabblet.css
Created August 12, 2023 22:08
CSS nesting testcase
/**
* CSS nesting testcase
*/
body {
background: red;
}
html {
& body {
/**
* Tooltips
*/
span {
font: bold 300%/1.5 system-ui;
}
@LeaVerou
LeaVerou / dabblet.css
Created May 6, 2023 04:04
text-wrap: balance bug
/**
* text-wrap: balance bug
*/
body { width: 750px }
div {
width: 200px; height: 200px;
background: red;
@LeaVerou
LeaVerou / dabblet.css
Last active April 23, 2023 06:43
OKLch rainbow?
/**
* OKLch rainbow?
*/
--hc: 70% .2;
background: linear-gradient(to left in oklch longer, oklch(var(--hc) 0), oklch(var(--hc) 359));