jeremydouglass / rosetta_examples_p5

Example set from Rosetta Code for P5 (Processing)
Other
10 stars 2 forks source link

Color bars display #74

Open jeremydouglass opened 4 years ago

jeremydouglass commented 4 years ago

This is a working example of a "total set" submission -- with a version for Java mode, Python mode, Processing.R, and p5.js JavaScript. It could use a JRubyArt example.

monkstone commented 4 years ago

JrubyArt version now at Rosetta Code

# Array of web colors black, red, green, blue, magenta, cyan, yellow, white
PALETTE = %w[#000000 #ff0000 #00ff00 #0000ff #ff00ff #00ffff #ffffff].freeze

def settings
  full_screen
end

def setup
  PALETTE.each_with_index do |col, idx|
    fill color(col)
    rect(idx * width / 8, 0, width / 8, height)
  end
end