improve colours script (but not its name, which is still silly)
This commit is contained in:
parent
53f3a62d38
commit
a717b5f516
1 changed files with 15 additions and 2 deletions
17
colours.rb
17
colours.rb
|
|
@ -31,6 +31,19 @@ redf ||= red.to_f / 255
|
||||||
greenf ||= green.to_f / 255
|
greenf ||= green.to_f / 255
|
||||||
bluef ||= blue.to_f / 255
|
bluef ||= blue.to_f / 255
|
||||||
|
|
||||||
|
puts "Red: #{red} / #{redf}"
|
||||||
|
puts "Green: #{green} / #{greenf}"
|
||||||
|
puts "Blue: #{blue} / #{bluef}"
|
||||||
|
puts
|
||||||
|
|
||||||
puts '#' + hex
|
puts '#' + hex
|
||||||
puts "RGB (#{red}, #{green}, #{blue})"
|
puts "rgb(#{red}, #{green}, #{blue})"
|
||||||
puts "Red:#{redf} green:#{greenf} blue:#{bluef}"
|
puts
|
||||||
|
|
||||||
|
if red == green && green == blue
|
||||||
|
puts "[UIColor colorWithWhite:#{'%0.3g' % redf} alpha:1]"
|
||||||
|
puts "UIColor(white: #{'%0.3g' % redf}, alpha: 1)"
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "[UIColor colorWithRed:#{red}/255.0 green:#{green}/255.0 blue:#{blue}/255.0 alpha:1]"
|
||||||
|
puts "UIColor(red: #{red}/255.0, green: #{green}/255.0, blue: #{blue}/255.0, alpha: 1)"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue