| Class | Limelight::DSL::StyleBuilder |
| In: |
lib/limelight/dsl/styles_builder.rb
|
| Parent: | Object |
Styles may extend other styles.
base {
background_color :red
}
cell {
extends :base
text_color :black
}
The ‘cell’ style now has all attributes defined in ‘base’. Therefore any prop using the ‘cell’ style will have a red background. Styles may override attributes aquired through extension.
# File lib/limelight/dsl/styles_builder.rb, line 133
133: def extends(*style_names)
134: style_names.each do |style_name|
135: extension = @__styles_builder.__styles[style_name.to_s] || @__styles_builder.__extendable_styles[style_name.to_s]
136: raise StyleBuilderException.new("Can't extend missing style: '#{style_name}'") if extension.nil?
137: @__style.add_extension(extension)
138: end
139: end
Used to define a hover style. Hover styles are appiled when the mouse passed over a prop using the specified style.
spinner {
width 50
height 50
hover {
text_color :white
}
}
The text color of props using the ‘spinner’ style will become white when the mouse hovers over them.
# File lib/limelight/dsl/styles_builder.rb, line 115
115: def hover(&block)
116: @__styles_builder.__add_style("#{@__name}.hover", &block)
117: end