Created
November 27, 2011 03:30
-
-
Save tmtk75/1396891 to your computer and use it in GitHub Desktop.
Color Wheel CSS Generate
This file contains 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
#!/usr/bin/ruby | |
=begin | |
Script to generate scss for color-wheel. | |
=end | |
$saturation = ARGV[0] || 100 | |
$luminousness = ARGV[1] || 50 | |
$split = ARGV[2].to_i || 24 | |
def mk_suffix(deg) | |
"#{deg}_#{$saturation}_#{$luminousness}" | |
end | |
(0..($split - 1)).each {|e| | |
d = e*360.0/$split | |
#puts "#{e} #{$split} #{d}\n" | |
deg = sprintf "%03d", d | |
suffix = mk_suffix deg | |
print <<-EOF | |
$HSL_#{suffix}: hsl(#{deg}deg, #{$saturation}%, #{$luminousness}%); | |
.hsl_#{suffix} {background-color: $HSL_#{suffix};} | |
EOF | |
if d < 100 | |
puts ".hsl_#{sprintf "%d", d}_#{$saturation}_#{$luminousness} {background-color: $HSL_#{suffix};}" | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment