lrgb

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Provides a color.Color type for dealing with linear RGB colours without alpha.

Index

Constants

This section is empty.

Variables

View Source
var Model = helper.Model(Convert)

A color.Model for converting arbitrary colours to a linear RGB Color.

Wraps the Convert function, returning a color.Color interface rather than the Color type.

Functions

func Distance

func Distance(a, b Color) float64

Distance returns the euclidean distance between two colours,

If you just want to compare relative distances, use DistanceSqr instead.

func DistanceSqr

func DistanceSqr(a, b Color) float64

DistanceSqr returns the euclidean distance squared between two colours.

Types

type Color

type Color struct {
	R, G, B float64
}

Color is a linear RGBA color.Color.

func Convert

func Convert(c color.Color) Color

Convert converts an arbitrary colour type to a linear RGB Color.

func (Color) NLRGBA

func (c Color) NLRGBA() (r, g, b, a float64)

NLRGBA converts to non-premultiplied linear RGBA.

func (Color) NOkLabA

func (c Color) NOkLabA() (lightness, chromaA, chromaB, a float64)

NOkLabA converts to non-premultiplied OkLab+Alpha.

func (Color) NRGBA

func (c Color) NRGBA() (r, g, b, a uint32)

NRGBA converts to non-premultiplied RGBA.

func (Color) NXYZA

func (c Color) NXYZA() (x, y, z, a float64)

NXYZA converts to non-premultiplied XYZ+Alpha.

func (Color) RGBA

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

RGBA converts to premultiplied RGBA, implementing the color.Color interface.

Jump to

Keyboard shortcuts

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