Skip to content

Instantly share code, notes, and snippets.

View vidartf's full-sized avatar

Vidar Tonaas Fauske vidartf

View GitHub Profile
@vidartf
vidartf / wcag-color-contrast.ts
Last active January 10, 2018 14:19
WCAG color contrast
// Copyright Simula Research Laboratory 2018
// Licenced under BSD-3
// This follows https://www.w3.org/TR/WCAG20-TECHS/G17.html
function transValue(value: number) {
if value <= 0.03928{
return value / 12.92;
} else {
return Math.pow((RsRGB + 0.055) / 1.055, 2.4);