Created
September 17, 2010 19:49
-
-
Save bhauman/584817 to your computer and use it in GitHub Desktop.
sass function to test if a color is a dark color
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Sass::Script::Functions | |
| def dark_color(color) | |
| assert_type color, :Color | |
| Sass::Script::Bool.new( (color.rgb.sum / 3.0) < 128 ) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment