this is a dumping ground for some quick experiements.
chat applications often let users set any name color. that usually causes problems with contrast against different background colors. i made this cause i couldn't find something that did this.
here's the code running on this page (using some functions from this gist for oklab conversion)
function clamp(x, min, max) { return Math.min(Math.max(x, min), max); } function getReadableNameColor(minContrast, fgHex, bgHex) { const fg = rgbToOklab(hexToRGB(fgHex)); const bg = rgbToOklab(hexToRGB(bgHex)); // if we are already within minContrast, we dont need to do anything if (Math.abs(bg.L - fg.L) > minContrast) return fgHex; const defaultOffset = bg.L < 0.5 ? minContrast : -minContrast; const offset = fg.L > bg.L ? bg.L + minContrast > 1 ? defaultOffset : minContrast : bg.L - minContrast < 0 ? defaultOffset : -minContrast; const L = clamp(bg.L + offset, 0.0, 1.0); return rgbToHex( oklabToSRGB({ L, a: fg.a, b: fg.b, }) ); } function getReadableTextColor(bgHex) { const bg = rgbToOklab(hexToRGB(bgHex)); return bg.L < 0.5 ? "#ffffff" : "#000000"; }
you can use this under the terms of the mit license.
dfpwm is a one bit per sample audio codec. this plugin converts a signal to dfpwm and back.
this codec was originally designed for use in minecraft mods, but it works pretty good as an effect i think.
dfpwm was invented by Ben "GreaseMonkey" Russell, and i ported it to an audio plugin.
you can read more about how dfpwm works here.
Dry
Wet
Windows x86_64 | VST3 | Clap |