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
-
#background ⇒ Object
Background color or array of two colors.
-
#colors ⇒ Object
Array of colors for data graphs.
-
#font_family ⇒ Object
Font family: Not really supported.
-
#marker ⇒ Object
Marker color for grid lines, values, etc.
Instance Method Summary collapse
-
#darken(color, shift = 20) ⇒ Object
todo: Implement darken function.
-
#initialize(descriptor) ⇒ Base
constructor
Returns a new Scruffy::Themes::Base object.
-
#lighten(color, shift = 20) ⇒ Object
todo: Implement lighten function.
-
#next_color ⇒ Object
Returns the next available color in the color array.
Constructor Details
#initialize(descriptor) ⇒ Base
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
#background ⇒ Object
Background color or array of two colors
20 21 22 |
# File 'lib/scruffy/themes.rb', line 20 def background @background end |
#colors ⇒ Object
Array of colors for data graphs
21 22 23 |
# File 'lib/scruffy/themes.rb', line 21 def colors @colors end |
#font_family ⇒ Object
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 |
#marker ⇒ Object
Marker color for grid lines, values, etc.
22 23 24 |
# File 'lib/scruffy/themes.rb', line 22 def marker @marker end |
Instance Method Details
#darken(color, shift = 20) ⇒ Object
todo: Implement darken function.
50 |
# File 'lib/scruffy/themes.rb', line 50 def darken(color, shift=20); end |
#lighten(color, shift = 20) ⇒ Object
todo: Implement lighten function.
53 |
# File 'lib/scruffy/themes.rb', line 53 def lighten(color, shift=20); end |
#next_color ⇒ Object
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 @previous_color += 1 self.colors[(@previous_color-1) % self.colors.size] end |