Skip to content

Instantly share code, notes, and snippets.

@SinBirb
SinBirb / check_darkmode.js
Created October 26, 2017 16:37
Heuristic to check whether a site appears dark or bright to a user
/* round num to c digits */
function round(num, c) {
return +(Math.round(num + "e+" + c) + "e-" + c);
}
/* Adapted from Python from manojpandey, thanks!
https://gist.github.com/manojpandey/f5ece715132c572c80421febebaf66ae
*/
function rgbTolab(inputColor) {