Class: Scruffy::Themes::Base
- Inherits:
-
Object
- Object
- Scruffy::Themes::Base
- Defined in:
- lib/scruffy/themes.rb
Overview
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.
Instance Attribute Summary (collapse)
-
- (Object) background
Returns the value of attribute background.
-
- (Object) colors
Returns the value of attribute colors.
-
- (Object) font_family
Background color or array of two colors Array of colors for data graphs Marker color for grid lines, values, etc.
-
- (Object) marker
Returns the value of attribute marker.
Instance Method Summary (collapse)
-
- (Object) darken(color, shift = 20)
todo: Implement darken function.
-
- (Base) initialize(descriptor)
constructor
Returns a new Scruffy::Themes::Base object.
-
- (Object) lighten(color, shift = 20)
todo: Implement lighten function.
-
- (Object) next_color
Returns the next available color in the color array.
Constructor Details
- (Base) initialize(descriptor)
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. |
34 35 36 37 38 39 |
# 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 |
Instance Attribute Details
- (Object) background
Returns the value of attribute background
20 21 22 |
# File 'lib/scruffy/themes.rb', line 20 def background @background end |
- (Object) colors
Returns the value of attribute colors
21 22 23 |
# File 'lib/scruffy/themes.rb', line 21 def colors @colors end |
- (Object) font_family
Background color or array of two colors Array of colors for data graphs Marker color for grid lines, values, etc. Font family: Not really supported. Maybe in the future.
23 24 25 |
# File 'lib/scruffy/themes.rb', line 23 def font_family @font_family end |
- (Object) marker
Returns the value of attribute marker
22 23 24 |
# File 'lib/scruffy/themes.rb', line 22 def marker @marker end |
Instance Method Details
- (Object) darken(color, shift = 20)
todo: Implement darken function.
50 |
# File 'lib/scruffy/themes.rb', line 50 def darken(color, shift=20); end |
- (Object) lighten(color, shift = 20)
todo: Implement lighten function.
53 |
# File 'lib/scruffy/themes.rb', line 53 def lighten(color, shift=20); end |
- (Object) next_color
Returns the next available color in the color array.
42 43 44 45 46 47 |
# File 'lib/scruffy/themes.rb', line 42 def next_color @previous_color = 0 if @previous_color.nil? @previous_color += 1 self.colors[(@previous_color-1) % self.colors.size] end |