[devdocsgjs/main: 449/1867] Add comments to magic values




commit cdd86a8fbe87c73ab29383e6eec79043843e3cea
Author: Jasper van Merle <jaspervmerle gmail com>
Date:   Sun Oct 21 18:52:26 2018 +0200

    Add comments to magic values

 lib/tasks/sprites.thor | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/lib/tasks/sprites.thor b/lib/tasks/sprites.thor
index 64dd82b4..bd2ff781 100644
--- a/lib/tasks/sprites.thor
+++ b/lib/tasks/sprites.thor
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]