Class: Less2Sass::Less::Tree::ColorNode

Inherits:
Node
  • Object
show all
Defined in:
lib/less2sass/less/tree/color_node.rb

Overview

CSS color representation.

Usually appears at variable definitions. Example:

- `@color: #fff;` rule contains ColorNode
- `color: #fff;` property declaration does
  not contain ColorNode

The Sass equivalent is Sass::Script::Value::Color.

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #has_children, #has_parent, #line, #parent, #ref_vars

Instance Method Summary collapse

Methods inherited from Node

#<<, #==, #contains_variables?, #creates_context?, #each, #get_referenced_variable_names, #initialize, #transform

Constructor Details

This class inherits a constructor from Less2Sass::Less::Tree::Node

Instance Attribute Details

#alphaObject

Returns the value of attribute alpha.



15
16
17
# File 'lib/less2sass/less/tree/color_node.rb', line 15

def alpha
  @alpha
end

#rgbObject

Returns the value of attribute rgb.



14
15
16
# File 'lib/less2sass/less/tree/color_node.rb', line 14

def rgb
  @rgb
end

#valueObject

Returns the value of attribute value.



16
17
18
# File 'lib/less2sass/less/tree/color_node.rb', line 16

def value
  @value
end

Instance Method Details

#to_sass::Sass::Script::Value::Color

Returns:

  • (::Sass::Script::Value::Color)

See Also:



20
21
22
23
# File 'lib/less2sass/less/tree/color_node.rb', line 20

def to_sass
  color = node(::Sass::Script::Value::Color.new(@rgb, @value), nil)
  node(::Sass::Script::Tree::Literal.new(color), line)
end