Method: Nyaplot::Color#to_html

Defined in:
lib/nyaplot/color.rb

#to_htmlString

display colorset on IRuby notebook as a html table

Returns:

  • (String)

    generated html



64
65
66
67
68
69
70
71
# File 'lib/nyaplot/color.rb', line 64

def to_html
  html = '<table><tr>'
  @source.each{|color| html.concat("<th>" + color + "</th>")}
  html.concat("</tr><tr>")
  @source.each{|color| html.concat("<td style=\"background-color:" + color + ";\">&nbsp;</td>")}
  html += '</tr></table>'
  return html
end