runner.work.colors.colors

Constants #

const (
	min_contrast_ratio = 1.0
	max_contrast_ratio = 21.0
)

fn eq_rgb_gx #

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 #

fn from(input int) ?RGB

from returns an RGB color model from an integer representation.

fn hsl_from_gx #

fn hsl_from_gx(c gx.Color) HSL

rgb_from_gx converts gx.Color structure to HSL structure.

fn hsv_from_gx #

fn hsv_from_gx(c gx.Color) HSV

rgb_from_gx converts gx.Color structure to HSV structure.

fn parse #

fn parse(input string) ?RGB

parse parses a given string and returns an RGB color model.

fn rgb_from_gx #

fn rgb_from_gx(c gx.Color) RGB

rgb_from_gx converts gx.Color structure to RGB structure.

struct HSL #

struct HSL {
pub:
	h int
	s f64
	l f64
}

Structure representing HSL color model.

fn (HSL) darken #

fn (val HSL) darken(value f64) HSL

darken changes lightness of a given HSL struct and returns new struct.

fn (HSL) desaturate #

fn (val HSL) desaturate(value f64) HSL

desaturate changes saturation of a given HSL struct and returns new struct.

fn (HSL) eq #

fn (a HSL) eq(b HSL) bool

eq checks if a given HSL struct is equal to a caller.

fn (HSL) eq_approx #

fn (a HSL) eq_approx(b HSL) bool

eq_approx checks if a given HSL struct is approximalely equal to a caller.

fn (HSL) gx #

fn (val HSL) gx() gx.Color

gx converts HSL to gx.Color structure.

fn (HSL) hsv #

fn (val HSL) hsv() HSV

hsl converts HSL to HSV.

fn (HSL) lighten #

fn (val HSL) lighten(value f64) HSL

lighten changes lightness of a given HSL struct and returns new struct.

fn (HSL) rgb #

fn (val HSL) rgb() RGB

hsl converts HSL to RGB.

fn (HSL) rotate #

fn (val HSL) rotate(degrees int) HSL

rotate changes hue of a given HSL struct and returns new struct.

fn (HSL) saturate #

fn (val HSL) saturate(value f64) HSL

saturate changes saturation of a given HSL struct and returns new struct.

fn (HSL) str #

fn (val HSL) str() string

str returns a string representation of a HSL struct.

struct HSV #

struct HSV {
pub:
	h int
	s f64
	v f64
}

Structure representing HSV color model.

fn (HSV) eq #

fn (a HSV) eq(b HSV) bool

eq checks if a given HSV struct is equal to a caller.

fn (HSV) eq_approx #

fn (a HSV) eq_approx(b HSV) bool

eq_approx checks if a given HSV struct is approximalely equal to a caller.

fn (HSV) gx #

fn (val HSV) gx() gx.Color

gx converts HSL to gx.Color structure.

fn (HSV) hsl #

fn (val HSV) hsl() HSL

hsl converts HSV to HSL.

fn (HSV) rgb #

fn (val HSV) rgb() RGB

rgb converts HSV to RGB.

fn (HSV) str #

fn (val HSV) str() string

str returns a string representation of a HSV struct.

struct RGB #

struct RGB {
pub:
	r int
	g int
	b int
}

Structure representing RGB color model.

fn (RGB) contrast_ratio #

fn (a RGB) contrast_ratio(b RGB) f64

contrast_ratio returns a contrast ratio between two colors.

fn (RGB) contrast_score #

fn (a RGB) contrast_score(b RGB) string

contrast_score returns a contrast score between two colors.

fn (RGB) eq #

fn (a RGB) eq(b RGB) bool

eq checks if a given RGB struct is equal to a caller.

fn (RGB) eq_approx #

fn (a RGB) eq_approx(b RGB) bool

eq_approx checks if a given RGB struct is approximalely equal to a caller.

fn (RGB) grayscale #

fn (val RGB) grayscale() RGB

grayscale returns a grayscale color from a true color.

fn (RGB) gx #

fn (val RGB) gx() gx.Color

gx converts RGB to gx.Color structure.

fn (RGB) hex #

fn (val RGB) hex() string

hex returns a string representation of RGB struct in hexadecimal format.

fn (RGB) hsl #

fn (val RGB) hsl() HSL

hsl converts RGB to HSL.

fn (RGB) hsv #

fn (val RGB) hsv() HSV

hsl converts RGB to HSV.

fn (RGB) invert #

fn (val RGB) invert() RGB

invert inverts a color.

fn (RGB) is_dark #

fn (val RGB) is_dark() bool

is_light checks if a color is dark.

fn (RGB) is_light #

fn (val RGB) is_light() bool

is_light checks if a color is light.

fn (RGB) luminance #

fn (val RGB) luminance() f64

luminance returns a relative luminance of a color.

fn (RGB) str #

fn (val RGB) str() string

str returns a string representation of a RGB struct.