Add comments to magic values

pull/870/head
Jasper van Merle 6 years ago
parent 9551fbc29e
commit cdd86a8fbe

@ -105,6 +105,8 @@ class SpritesCLI < Thor
end
def get_contrast(base, other)
# Calculating the contrast ratio as described in the WCAG 2.0:
# https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
l1 = get_luminance(base) + 0.05
l2 = get_luminance(other) + 0.05
ratio = l1 / l2
@ -118,6 +120,9 @@ class SpritesCLI < Thor
ChunkyPNG::Color.b(color).to_f
]
# Calculating the relative luminance as described in the WCAG 2.0:
# https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
rgb.map! do |value|
value /= 255
value < 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4

Loading…
Cancel
Save