Skip to content

Instantly share code, notes, and snippets.

@tmtk75
Created November 27, 2011 03:30
Show Gist options
  • Save tmtk75/1396891 to your computer and use it in GitHub Desktop.
Save tmtk75/1396891 to your computer and use it in GitHub Desktop.
Color Wheel CSS Generate
#!/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