Brasten Sager & A.J. Ostman
August 27th, 2006
The base theme class. Most themes can be constructed simply by instantiating a new Base object with a hash of color values.
See Scruffy::Themes::Base#instantiate for examples.
Returns a new Scruffy::Themes::Base object.
Hash options:
background color.
an array of color values to use for graphs.
color used for grid lines, values, data points, etc.
in general, allows you to change the font used in the graph. This is not yet supported in most graph elements, and may be deprecated soon anyway.
# File lib/scruffy/themes.rb, line 39 def initialize(descriptor) self.background = descriptor[:background] self.colors = descriptor[:colors] self.outlines = descriptor[:outlines] self.grid = descriptor[:grid] self.marker = descriptor[:marker] self.font_family = descriptor[:font_family] self.marker_font_size = descriptor[:marker_font_size] self.title_font_size = descriptor[:title_font_size] self.legend_font_size = descriptor[:legend_font_size] end
todo: Implement darken function.
# File lib/scruffy/themes.rb, line 71 def darken(color, shift=20); end
todo: Implement lighten function.
# File lib/scruffy/themes.rb, line 74 def lighten(color, shift=20); end
Returns the next available color in the color array.
# File lib/scruffy/themes.rb, line 52 def next_color @previous_color = 0 if @previous_color.nil? @previous_color += 1 self.colors[(@previous_color-1) % self.colors.size] end
Returns the next available outline in the outline array.
# File lib/scruffy/themes.rb, line 61 def next_outline @previous_outline = 0 if @previous_outline.nil? @previous_outline += 1 if self.outlines.nil? return "#000000" end self.outlines[(@previous_outline-1) % self.outlines.size] end