Sha256: 9922d57c124fde63b21c8ec6d083c958c7398c5bb0ddcb88bf67bc78399094a3
Contents?: true
Size: 699 Bytes
Versions: 10
Compression:
Stored size: 699 Bytes
Contents
# Each color is perceived in relation to other colors. # The top and bottom bars each contain the same component colors, # but a different display order causes individual colors to appear differently. def setup size 640, 480 a = color 165, 167, 20 b = color 77, 86, 59 c = color 42, 106, 105 d = color 165, 89, 20 e = color 146, 150, 127 no_stroke draw_band [a, b, c, d, e], 0, 4 draw_band [c, a, d, b, e], height/2, 4 end def draw_band( color_order, ypos, bar_width ) num = color_order.length (0...width).step(bar_width * num) do |i| num.times do |j| fill color_order[j] rect i + j*bar_width, ypos, bar_width, height/2 end end end
Version data entries
10 entries across 10 versions & 1 rubygems