color

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Difference

func Difference(reference, sample Oklab) (deltaEOK float32)

Types

type LCh

type LCh struct {
	L float32
	C float32
	H float32
	A float32
}

func (LCh) Lab

func (c LCh) Lab() Lab

type Lab

type Lab struct {
	L     float32
	A     float32
	B     float32
	Alpha float32
}

func (Lab) LCh

func (c Lab) LCh() LCh

type LinearSRGB

type LinearSRGB RGB

func (LinearSRGB) Oklab

func (c LinearSRGB) Oklab() Oklab

func (LinearSRGB) SRGB

func (c LinearSRGB) SRGB() SRGB

type Oklab

type Oklab Lab

func (Oklab) LinearSRGB

func (c Oklab) LinearSRGB() LinearSRGB

LinearSRGB converts from Oklab to linear sRGB, without applying gamut mapping. That is, if the color falls outside the sRGB gamut, the resulting R, G, and B channels may have values larger than 1 or less than 0. You can use Oklch.MapToSRGBGamut to prevent this from happening.

func (Oklab) Oklch

func (c Oklab) Oklch() Oklch

type Oklch

type Oklch LCh

func (Oklch) MapToSRGBGamut

func (c Oklch) MapToSRGBGamut() LinearSRGB

MapToSRGBGamut maps colors that fall outside the sRGB gamut to the sRGB gamut. It uses the same algorithm as CSS Color Module Level 4. Note that the mapping implements a relative colorimetric intent. That is, colors that are already inside the gamut are unchanged. This is intended for mapping individual colors, not for mapping images.

func (Oklch) NRGBA added in v0.4.0

func (c Oklch) NRGBA() color.NRGBA

func (Oklch) Oklab

func (c Oklch) Oklab() Oklab

type RGB

type RGB struct {
	R float32
	G float32
	B float32
	A float32
}

type SRGB

type SRGB RGB

func (SRGB) HTML

func (c SRGB) HTML() string

func (SRGB) LinearSRGB

func (c SRGB) LinearSRGB() LinearSRGB

func (SRGB) RGBA

func (c SRGB) RGBA() (r, g, b, a uint32)

Jump to

Keyboard shortcuts

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