class Scruffy::Themes::Base
Scruffy::Themes::Base¶ ↑
- Author
-
Brasten Sager & A.J. Ostman
- Date
-
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.
Attributes
background[RW]
colors[RW]
font_family[RW]
marker[RW]
Public Class Methods
new(descriptor)
click to toggle source
Returns a new Scruffy::Themes::Base object.
Hash options:
- background
-
background color.
- colors
-
an array of color values to use for graphs.
- marker
-
color used for grid lines, values, data points, etc.
- #font_family
-
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 34 def initialize(descriptor) self.background = descriptor[:background] self.colors = descriptor[:colors] self.marker = descriptor[:marker] self.font_family = descriptor[:font_family] end
Public Instance Methods
darken(color, shift=20)
click to toggle source
todo: Implement darken function.
# File lib/scruffy/themes.rb, line 50 def darken(color, shift=20); end
lighten(color, shift=20)
click to toggle source
todo: Implement lighten function.
# File lib/scruffy/themes.rb, line 53 def lighten(color, shift=20); end
next_color()
click to toggle source
Returns the next available color in the color array.
# File lib/scruffy/themes.rb, line 42 def next_color @previous_color ||= 0 @previous_color += 1 self.colors[(@previous_color-1) % self.colors.size] end