const (
min_contrast_ratio = 1.0
max_contrast_ratio = 21.0
)
fn eq_rgb_gx(a RGB, b gx.Color) bool
eq_rgb_gx checks if a given RGB and gx.Color structures are equal.
fn from(input int) ?RGB
from returns an RGB color model from an integer representation.
fn hsl_from_gx(c gx.Color) HSL
rgb_from_gx converts gx.Color structure to HSL structure.
fn hsv_from_gx(c gx.Color) HSV
rgb_from_gx converts gx.Color structure to HSV structure.
fn parse(input string) ?RGB
parse parses a given string and returns an RGB color model.
fn rgb_from_gx(c gx.Color) RGB
rgb_from_gx converts gx.Color structure to RGB structure.
struct HSL {
pub:
h int
s f64
l f64
}
Structure representing HSL color model.
fn (val HSL) darken(value f64) HSL
darken changes lightness of a given HSL struct and returns new struct.
fn (val HSL) desaturate(value f64) HSL
desaturate changes saturation of a given HSL struct and returns new struct.
fn (a HSL) eq(b HSL) bool
eq checks if a given HSL struct is equal to a caller.
fn (a HSL) eq_approx(b HSL) bool
eq_approx checks if a given HSL struct is approximalely equal to a caller.
fn (val HSL) gx() gx.Color
gx converts HSL to gx.Color structure.
fn (val HSL) hsv() HSV
hsl converts HSL to HSV.
fn (val HSL) lighten(value f64) HSL
lighten changes lightness of a given HSL struct and returns new struct.
fn (val HSL) rgb() RGB
hsl converts HSL to RGB.
fn (val HSL) rotate(degrees int) HSL
rotate changes hue of a given HSL struct and returns new struct.
fn (val HSL) saturate(value f64) HSL
saturate changes saturation of a given HSL struct and returns new struct.
fn (val HSL) str() string
str returns a string representation of a HSL struct.
struct HSV {
pub:
h int
s f64
v f64
}
Structure representing HSV color model.
fn (a HSV) eq(b HSV) bool
eq checks if a given HSV struct is equal to a caller.
fn (a HSV) eq_approx(b HSV) bool
eq_approx checks if a given HSV struct is approximalely equal to a caller.
fn (val HSV) gx() gx.Color
gx converts HSL to gx.Color structure.
fn (val HSV) hsl() HSL
hsl converts HSV to HSL.
fn (val HSV) rgb() RGB
rgb converts HSV to RGB.
fn (val HSV) str() string
str returns a string representation of a HSV struct.
struct RGB {
pub:
r int
g int
b int
}
Structure representing RGB color model.
fn (a RGB) contrast_ratio(b RGB) f64
contrast_ratio returns a contrast ratio between two colors.
fn (a RGB) contrast_score(b RGB) string
contrast_score returns a contrast score between two colors.
fn (a RGB) eq(b RGB) bool
eq checks if a given RGB struct is equal to a caller.
fn (a RGB) eq_approx(b RGB) bool
eq_approx checks if a given RGB struct is approximalely equal to a caller.
fn (val RGB) grayscale() RGB
grayscale returns a grayscale color from a true color.
fn (val RGB) gx() gx.Color
gx converts RGB to gx.Color structure.
fn (val RGB) hex() string
hex returns a string representation of RGB struct in hexadecimal format.
fn (val RGB) hsl() HSL
hsl converts RGB to HSL.
fn (val RGB) hsv() HSV
hsl converts RGB to HSV.
fn (val RGB) invert() RGB
invert inverts a color.
fn (val RGB) is_dark() bool
is_light checks if a color is dark.
fn (val RGB) is_light() bool
is_light checks if a color is light.
fn (val RGB) luminance() f64
luminance returns a relative luminance of a color.
fn (val RGB) str() string
str returns a string representation of a RGB struct.