Skip to content

Instantly share code, notes, and snippets.

View Daniel-Walsh's full-sized avatar
So much to code, so little sleep...

Dan Walsh Daniel-Walsh

So much to code, so little sleep...
View GitHub Profile
@Daniel-Walsh
Daniel-Walsh / color.ts
Created April 24, 2023 05:49 — forked from mnpenner/color.ts
RGB color hex to lightness
// based on https://stackoverflow.com/a/56678483/65387
type RGB = [r: number, g: number, b: number]
const UNK = 255 / 2
/**
* @param hex RGB hex string like "#CCCFDB"
* @returns RGB tuple in [0-255]
*/