Color class
RGB Colors: #rgb #rgba #rrggbb #rrggbbaa
- Inheritance
- Object
- Node
- Color
- Implemented types
Constructors
- Color(String rgb, [dynamic alpha = 1, String originalForm])
-
The end goal here, is to parse the arguments
into an integer triplet, such as
128, 255, 0
[...] - Color.fromKeyword(String keyword)
-
factory
- Color.fromList(dynamic rgb, [dynamic alpha = 1, String originalForm])
-
rgb
is a List128, 255, 0
or62.2, 125.5, 67
The decimal arguments came from color operations
Properties
-
allExtends
↔ List<
Extend> -
For extends visitor process
read / write, inherited
- allowRoot ↔ bool
-
The Node type could be used in the root ruleset
read / write, inherited
- alpha ↔ num
-
0 to 1.0
read / write
- alphaAsString → String
-
Alpha without trailing zeros: 0 0.1 1
read-only
- b → num
-
blue 0 to 255, could be xx.xxx
read-only
- blue → double
-
0 to 1 -> 0.xxx
read-only
- cleanCss ↔ CleanCssContext
-
Info to optimize the node with cleanCss
read / write, inherited
- currentFileInfo ↔ FileInfo
-
get fileInfo from this node or their parent
read / write, inherited
- debugInfo ↔ DebugInfo
-
Filename and line coordinates for error debug
read / write, inherited
-
elements
↔ List<
Element> -
Selector elements
read / write, inherited
- evalFirst ↔ bool
-
DetachedRuleset and MixinDefinition must be evaluated before other nodes
in the Ruleset.eval() funciton
read / write, inherited
- evaluated ↔ bool
-
result from bool eval, used in condition
read / write, inherited
- g → num
-
green 0 to 255, could be xx.xxx
read-only
- green → double
-
0 to 1 -> 0.xxx
read-only
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- id ↔ int
-
hashCode own or inherited for object comparation
read / write, inherited
- index ↔ int
-
index from this node or their parent, position in the less file
read / write, inherited
- isRuleset ↔ bool
-
True if is a Ruleset or MixinDefinition
read / write, inherited
- name → String
-
Node name
final
- nodeVisible ↔ bool
-
Only output css code for nodeVisible = true
read / write, inherited
-
operands
↔ List<
Node> -
For operation node
read / write, inherited
- originalRuleset ↔ Node
-
for Rulesets and mixins process
read / write, inherited
- parens ↔ bool
-
The node has been parsed inside parenthesis
()
read / write, inherited - parensInOp ↔ bool
-
for expression evaluation
read / write, inherited
- parent ↔ Node
-
parent Node, used by index and fileInfo.
read / write, inherited
- parsed ↔ bool
-
Some anonymous nodes are lazy parsed
read / write, inherited
- r → num
-
red 0 to 255, could be xx.xxx
read-only
- red → double
-
0 to 1 -> 0.xxx
read-only
-
rgb
↔ List<
num> -
r, g, b
. Not always int.read / write - rootNode ↔ bool
-
read / write, inherited
-
rules
↔ List<
Node> -
The ruleset rules
read / write, inherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
-
selectors
↔ List<
Selector> -
The ruleset selectors
read / write, inherited
-
treeField
→ Map<
String, dynamic> -
Fields to show with genTree
read-only, override
- type → String
-
Node generic name == class name
final
- value ↔ String
-
original form (#fea) or named color (blue) to return to CSS
Color space (rgb, hsl) from function operations, to preserve in output
read / write, covariant, override
- visibilityBlocks ↔ int
-
Node visibility control
read / write, inherited
Methods
-
accept(
VisitorBase visitor) → void -
inherited
-
addVisibilityBlock(
) → void -
inherited
-
blocksVisibility(
) → bool -
Returns true if this node represents root of was imported by reference
inherited
-
compare(
Node xx) → int -
Returns -1, 0 for different, equal
override
-
copyVisibilityInfo(
VisibilityInfo info) → void -
This node get the visibility from
info
inherited -
ensureInvisibility(
) → void -
Turns off node visibility - if called node will NOT be shown in output regardless
of whether it comes from import by reference or not
inherited
-
ensureVisibility(
) → void -
Turns on node visibility, that is, if called node will be shown in output
regardless of whether it comes from import by reference or not
inherited
-
eval(
Contexts env) → Node -
override
-
fileInfo(
) → FileInfo -
returns fileInfo from this node or their parent
inherited
-
fround(
Contexts context, num value, [int precision]) → num -
Adjust the precision of
value
according tocontext
.numPrecision. 8 By default. [...]inherited -
genCSS(
Contexts context, Output output) → void -
override
-
genTree(
Contexts env, Output output, [String prefix = '']) → void -
Writes in
output
the tree, for debuginherited -
genTreeField(
Contexts env, Output output, String fieldName, dynamic fieldValue) → void -
Build the subtree for a
fieldName
,fieldValue
inherited -
genTreeTitle(
Contexts env, Output output, String prefix, String type, String value) → void -
Build the node tree title
inherited
-
getIndex(
) → int -
returns index from this node or their parent
inherited
-
isCharset(
) → bool -
Directive overrides it
inherited
-
isRulesetLike(
) → bool -
inherited
-
isVisible(
) → bool -
return values:
false - the node must not be visible
true - the node must be visible
null - the node has the same visibility as its parent
inherited
-
luma(
) → double - Calculates the luma (perceptual brightness) of a color object Value between 0 for darkest and 1 for lightest.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
operate(
Contexts context, String op, Color other) → Color -
Operations have to be done per-channel, if not,
channels will spill onto each other. Once we have
our result, in the form of an integer triplet,
we create a new Color node to hold the result.
override
-
removeVisibilityBlock(
) → void -
inherited
-
setParent(
dynamic nodes, Node parent) → void -
Update
parent
property innodes
. [...]inherited -
throwAwayComments(
) → void -
inherited
-
toARGB(
) → String - Returns a String such as #aarrggbb
-
toCleanCSS(
Contexts context) → String - clean-css output
-
toCSS(
Contexts context) → String -
Returns this color as string. Transparent, #rrggbb, #rgb.
override
-
toHSL(
) → HSLType - Returns this Color as HSLA
-
toHSV(
) → HSVType -
toRGB(
) → String - Returns this color as String #rrggbb.
-
toRGBFunction(
Contexts context) → String - => 'rgba(r, g, b, a)'
-
toString(
) → String -
Returns a string representation of this object.
override
-
toTree(
LessOptions options) → StringBuffer -
debug print the node tree
inherited
-
tryHex3(
String hex) → String -
hex
== '#rrggbb' => '#rgb' else return unchanged -
visibilityInfo(
) → VisibilityInfo -
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited
Static Properties
- transparentKeyword ↔ String
-
read / write
Static Methods
-
getColorKey(
String value) → String -
value
== '#rrggbb' returns the color key (color name)