// description of your code here
  //This helper will generate a whole bunch o' colors in a drop down box, which which you can do whatever with. Currently I am allowing users to change certain colors of the page.
 def color_picker(name)
  #build the hexes
  hexes = []
  (0..15).step(3) do |one|
  (0..15).step(3) do |two|
  (0..15).step(3) do |three|
  hexes << "#" + one.to_s(16) + two.to_s(16) + three.to_s(16)
  end
  end
  end
  arr = []
  10.times { arr << " " }
  returning html = '' do
  html << "<select name=#{name}>"
  html << hexes.collect {|c|
  "<option value='#{c}' style='background-color: #{c}'>#{arr.join}</option>" }.join("\n")
  html << "</select>"
  end
  end
0 Comments:
Post a Comment