Color
classin packageklyn.gui.windows
public class Color:
Color
RGBA color used by `Painter`, `Pen` and `Brush`.
accent = Color(37, 99, 235, 1.0)
print(accent.toCssColor())
Properties
Modifier and Type Member Description
public property alpha
alpha as Double
Alpha channel in `[0.
public property blue
blue as Int
Blue channel in `[0, 255]`.
public property green
green as Int
Green channel in `[0, 255]`.
public property red
red as Int
Red channel in `[0, 255]`.
Constructors
Modifier and Type Member Description
public Color
Color(red as Int = 0, green as Int = 0, blue as Int = 0, alpha as Double = 1.0):
No summary.
Methods
Modifier and Type Member Description
public static black
black() as Color:
Returns an opaque black color.
public clone
clone() as Color:
Creates a copy of the color.
public darker
darker(amount as Double = 0.12) as Color:
Returns a darker variant of this color.
public static fromHex
fromHex(value as String) as Color:
Parses a `#RRGGBB` or `#RRGGBBAA` color literal.
public lighter
lighter(amount as Double = 0.12) as Color:
Returns a lighter variant of this color.
public mix
mix(other as Color, ratio as Double) as Color:
Mixes this color with another one.
public static parse
parse(value as String) as Color:
Parses a CSS-like color value.
public toCssColor
toCssColor() as String:
Serializes the color into a CSS-compatible `rgba(.
public override toString
toString() as String:
No summary.
public static transparent
transparent() as Color:
Returns a fully transparent black color.
public static white
white() as Color:
Returns an opaque white color.
public withAlpha
withAlpha(alpha as Double) as Color:
Returns the same RGB color with another alpha channel.