We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9551fbc commit cdd86a8Copy full SHA for cdd86a8
lib/tasks/sprites.thor
@@ -105,6 +105,8 @@ class SpritesCLI < Thor
105
end
106
107
def get_contrast(base, other)
108
+ # Calculating the contrast ratio as described in the WCAG 2.0:
109
+ # https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
110
l1 = get_luminance(base) + 0.05
111
l2 = get_luminance(other) + 0.05
112
ratio = l1 / l2
@@ -118,6 +120,9 @@ class SpritesCLI < Thor
118
120
ChunkyPNG::Color.b(color).to_f
119
121
]
122
123
+ # Calculating the relative luminance as described in the WCAG 2.0:
124
+ # https://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
125
+
126
rgb.map! do |value|
127
value /= 255
128
value < 0.03928 ? value / 12.92 : ((value + 0.055) / 1.055) ** 2.4
0 commit comments