ColorFunctions class
Properties
-
context
↔ Contexts
-
read / write, inherited
-
currentFileInfo
↔ FileInfo
-
read / write, inherited
-
hashCode
→ int
-
The hash code for this object.
read-only, inherited
-
index
↔ int
-
read / write, inherited
-
less
↔ TreeApi
-
read / write, inherited
-
name
↔ String
-
read / write, inherited
-
registry
↔ Map<String, FunctionRegistryItem>
-
Method registry: { 'externalName': {'name': internalName, 'listArguments': false} }
read / write, inherited
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
alpha(Node color)
→ Dimension
-
Extracts the alpha channel of a color object. [...]
-
argb(Color color)
→ Anonymous
-
Creates a hex representation of a color in #AARRGGBB format (NOT #RRGGBBAA!).
This format is used in Internet Explorer, and .NET and Android development. [...]
-
blue(Color color)
→ Dimension
-
Extracts the blue channel of a color object. [...]
-
clamp<T extends num>(T val)
→ T
-
Returns
val
clamped to be in the range 0..val..1.
Maintains type
@defineMethodSkip
-
color(dynamic c)
→ Color
-
Parses a color, so a string representing a color becomes a color. [...]
-
contrast(Node colorNode, [ Color dark, Color light, Dimension threshold ])
→ Color
-
Choose which of two colors provides the greatest contrast with another. [...]
-
darken(Node color, Dimension amount, [ Keyword method ])
→ Color
-
Decrease the lightness of a color in the HSL color space by an absolute amount. [...]
-
desaturate(Node color, Dimension amount, [ Keyword method ])
→ Color
-
Decrease the saturation of a color in the HSL color space by an absolute amount. [...]
-
fade(Node color, Dimension amount)
→ Color
-
Set the absolute transparency of a color. [...]
-
fadein(Node color, Dimension amount, [ Keyword method ])
→ Color
-
Decrease the transparency (or increase the opacity) of a color, making it more opaque.
Parameters:
color: A color object.
amount: A percentage 0-100%.
method: Optional, set to relative for the adjustment to be relative to the current value.
Returns: color
Example: fadein(hsla(90, 90%, 50%, 0.5), 10%)
Output: rgba(128, 242, 13, 0.6) // hsla(90, 90%, 50%, 0.6)
-
fadeout(Node color, Dimension amount, [ Keyword method ])
→ Color
-
Increase the transparency (or decrease the opacity) of a color, making it less opaque. [...]
-
green(Color color)
→ Dimension
-
Extracts the green channel of a color object. [...]
-
greyscale(Color color)
→ Color
-
Remove all saturation from a color in the HSL color space; the same as
calling desaturate(@color, 100%).
Parameters:
color: A color object.
Returns: color
Example: greyscale(hsl(90, 90%, 50%))
Output: #808080 // hsl(90, 0%, 50%)
-
hsl(dynamic h, [ dynamic s dynamic l ])
→ Color
-
Creates an opaque color object from hue, saturation and lightness (HSL) values. [...]
-
hsla(dynamic h, [ dynamic s dynamic l dynamic a ])
→ Color
-
Creates a transparent color object from hue, saturation, lightness and alpha (HSLA) values. [...]
-
hslaColorSpace(Color origColor, HSLType hsl)
→ Color
-
Returns a color from hsl, keeping the original color space
@defineMethodSkip
-
hsv(dynamic h dynamic s dynamic v)
→ Color
-
Creates an opaque color object from hue, saturation and value (HSV) values.
Note that this is a color space available in Photoshop, and is not the same as hsl. [...]
-
hsva(dynamic h dynamic s dynamic v dynamic a)
→ Color
-
Creates a transparent color object from hue, saturation, value and alpha (HSVA) values.
Note that this is not the same as hsla, and is a color space available in Photoshop. [...]
-
hsvhue(Node color)
→ Dimension
-
Extracts the hue channel of a color object in the HSV color space. [...]
-
hsvsaturation(Node color)
→ Dimension
-
Extracts the saturation channel of a color object in the HSV color space. [...]
-
hsvvalue(Node color)
→ Dimension
-
Extracts the value channel of a color object in the HSV color space. [...]
-
hue(Node color)
→ Dimension
-
Extracts the hue channel of a color object in the HSL color space. [...]
-
lighten(Node color, Dimension amount, [ Keyword method ])
→ Color
-
Increase the lightness of a color in the HSL color space by an absolute amount. [...]
-
lightness(Node color)
→ Dimension
-
Extracts the lightness channel of a color object in the HSL color space. [...]
-
luma(Color color)
→ Dimension
-
Calculates the luma (perceptual brightness) of a color object.
Parameters:
color - a color object.
Returns: percentage 0-100%
Example: luma(rgb(100, 200, 30))
Output: 44%
-
luminance(Color color)
→ Dimension
-
Calculates the value of the luma without gamma correction [...]
-
mix(Node color1, [ Node color2, [ Dimension weight ])
→ Color
-
Mix two colors together in variable proportion. Opacity is included in the calculations. [...]
-
number(dynamic n)
→ num
-
n
num | Node | error anything else
@defineMethodSkip
-
red(Color color)
→ Dimension
-
Extracts the red channel of a color object. [...]
-
rgb(dynamic r, [ dynamic g dynamic b ])
→ Color
-
Creates an opaque color object from decimal red, green and blue (RGB) values.
Literal color values in standard HTML/CSS formats may also be used to define colors,
for example #ff0000. [...]
-
rgba(dynamic r, [ dynamic g dynamic b dynamic a ])
→ Color
-
Creates a transparent color object from decimal red, green, blue and alpha (RGBA) values. [...]
-
saturate(Node color, [ Dimension amount, Keyword method ])
→ Color
-
Increase the saturation of a color in the HSL color space by an absolute amount. [...]
-
saturation(Node color)
→ Dimension
-
Extracts the saturation channel of a color object in the HSL color space. [...]
-
scaled(dynamic n, int size)
→ num
-
@defineMethodSkip
-
shade(Color color, Dimension amount)
→ Color
-
returns a
color
amount
% points darker
-
spin(Node color, Dimension amount)
→ Color
-
Rotate the hue angle of a color in either direction. While the angle range
is 0-360, it applies a mod 360 operation, so you can pass in much larger
(or negative) values and they will wrap around angles of 360 and 720 will
produce the same result. Note that colors are passed through an RGB
conversion, which doesn't retain hue value for greys (because hue has no
meaning when there is no saturation), so make sure you apply functions in
a way that preserves hue, for example don't do this: [...]
-
tint(Color color, Dimension amount)
→ Color
-
returns a
color
amount
% points lighter
-
toHSL(Node color)
→ HSLType
-
Convert
color
to HSL or throw error
@defineMethodSkip
-
toHSV(Node color)
→ HSVType
-
Convert
color
to HSV or throw error
@defineMethodSkip
-
call(List<Node> args)
→ dynamic
-
Call the last valid name of method
inherited
-
init(Contexts context, int index, FileInfo currentFileInfo)
→ void
-
Config functions with the necessarry information for processing
inherited
-
isValid(String name)
→ bool
-
Check if name is a method name available
inherited
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a non-existent method or property is accessed.
inherited
-
toString()
→ String
-
Returns a string representation of this object.
inherited
Operators
-
operator ==(dynamic other)
→ bool
-
The equality operator.
inherited