ok

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package ok contains OKLab/OKLch color implementations

Package ok contains OKLab/OKLch color implementations

Package ok contains OKLab/OKLch color implementations

Package ok contains OKLab/OKLch color implementations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChromaMap added in v0.9.3

func ChromaMap() chromaMap

ChromaMap returns the chromaMap, iniitalizing it if necessary.

func GetMaxChroma added in v0.9.3

func GetMaxChroma(lum, hue float64) float64

GetMaxChroma

func MakeChromaMap added in v0.9.3

func MakeChromaMap()

MakeChromaMap ...

Types

type Color

type Color struct {
	L, A, B float64
	C, H    float64
}

Color is an OKLab/OKLch color.

func FromRGB

func FromRGB(c blcolor.Color) Color

FromRGB creates a new ok color from a linear RGB color.

func FromRGBIntValues added in v0.9.2

func FromRGBIntValues(r, g, b int) Color

FromRGBIntValues creates a new ok color from red, green and blue int values (0-255)

func FromRGBValues

func FromRGBValues(r, g, b float64) Color

FromRGBValues creates a new ok color from red, green and blue values.

func Lab added in v0.9.2

func Lab(l, a, b float64) Color

Lab creates a new ok color from l, a, b values.

func Lch added in v0.9.2

func Lch(l, c, h float64) Color

Lch creates a new ok color from l, c, h values.

func Lerp

func Lerp(col0, col1 Color, t float64) Color

Lerp Interpolates between two ok colors.

func RandomLch added in v0.9.3

func RandomLch(l, c float64) Color

RandomLch returns an OK color with random hue and l, c as given.

func (Color) Chroma added in v0.9.3

func (c Color) Chroma() float64

Chroma returns the chroma of this color.

func (Color) Hue added in v0.9.2

func (c Color) Hue() float64

Hue returns the hue of this color as an angle from 0 to 360 degrees.

func (Color) Luminance added in v0.9.3

func (c Color) Luminance() float64

Luminance returns the luminance of this color 0.0 to 1.0.

func (*Color) SetChroma added in v0.9.3

func (c *Color) SetChroma(chroma float64)

SetChroma ...

func (*Color) SetHue added in v0.9.3

func (c *Color) SetHue(hue float64)

SetHue ...

func (*Color) SetLuminance added in v0.9.3

func (c *Color) SetLuminance(lum float64)

SetLuminance ...

func (Color) ToLinearSRGB

func (c Color) ToLinearSRGB(useFallback bool) blcolor.Color

ToLinearSRGB converts this ok color to a linear RGB color.

func (Color) ToSRGB

func (c Color) ToSRGB(useFallback bool) blcolor.Color

ToSRGB converts this ok color to a standard RGB color.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL