Color wheel: Difference between revisions
Content deleted Content added
→{{header|Processing Python mode}}: make subhead of Processing |
No edit summary |
||
Line 536:
Until local image uploading is re-enabled, see [https://github.com/thundergnat/rc/blob/master/img/Color-wheel-perl6.png Color-wheel-perl6.png]
=={{header|Ruby}}==
{{libheader|RubyGems}}
{{libheader|JRubyArt}}
<lang ruby>
def settings
size(300, 300)
end
def setup
sketch_title 'Color Wheel'
background(0)
radius = width / 2.0
center = width / 2
grid(width, height) do |x, y|
rx = x - center
ry = y - center
sat = Math.hypot(rx, ry) / radius
if sat <= 1.0
hue = ((Math.atan2(ry, rx) / PI) + 1) / 2.0
color_mode(HSB)
col = color((hue * 255).to_i, (sat * 255).to_i, 255)
set(x, y, col)
end
end
end
</lang>
=={{header|Run BASIC}}==
Line 625 ⟶ 652:
img.write(file => 'color_wheel.png')</lang>
Output image: [https://github.com/trizen/rc/blob/master/img/color-wheel-sidef.png Color wheel]
=={{header|Smart BASIC}}==
<lang smart basic>' Runs on iOS
|