Skip to content

Instantly share code, notes, and snippets.

const BASE83_ALPHABET = `0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~`;
const BASE64_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
const BMP_HEADER = `data:image/bmp;base64,Qk3mAQAAAAAAADYAAAAoAAAADAAAAPT///8BABgAAAAAALABAAAAAAAAAAAAAAAAAAAAAAAA`;
const sRGBToLinear = (value: number) => {
const v = value / 255;
if (v <= 0.04045) {
return v / 12.92;
} else {
return Math.pow((v + 0.055) / 1.055, 2.4);