lrgba

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 premultiplied linear RGBA colours.

Index

Constants

This section is empty.

Variables

View Source
var Model = helper.Model(Convert)

A color.Model for converting arbitrary colours to a premultiplied linear RGBA 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 maximum possible euclidean distance between two colours, accounting for the possible backgrounds they might be composited over.

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

func DistanceSqr

func DistanceSqr(a, b Color) float64

DistanceSqr returns the maximum possible euclidean distance squared between two colours, accounting for the possible backgrounds they might be composited over.

Types

type Color

type Color struct {
	R, G, B, A float64
}

Color is a pre-multiplied linear RGBA color.Color.

func Convert

func Convert(c color.Color) Color

Convert converts an arbitrary colour type to a premultiplied linear RGBA 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