colorx

package
v0.0.0-...-c164e21 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT, Unlicense Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Disabled

func Disabled(c color.NRGBA) (d color.NRGBA)

Disabled blends color towards the luminance and multiplies alpha. Blending towards luminance will desaturate the color. Multiplying alpha blends the color together more with the background.

func Hover

func Hover(c color.NRGBA) color.NRGBA

Hover returns a color representing the hover state for a clickable area.

func Hovered

func Hovered(c color.NRGBA) (d color.NRGBA)

Hovered blends color towards a brighter color.

func MulAlpha

func MulAlpha(c color.NRGBA, a uint8) color.NRGBA

MulAlpha returns the color with the alpha channel applied to c.

func NRGBAToLinearRGBA

func NRGBAToLinearRGBA(col color.NRGBA) color.RGBA

NRGBAToLinearRGBA converts from non-premultiplied sRGB color to premultiplied linear RGBA color.

Each component in the result is `c * alpha`, where `c` is the linear color.

func NRGBAToRGBA

func NRGBAToRGBA(col color.NRGBA) color.RGBA

NRGBAToRGBA converts from non-premultiplied sRGB color to premultiplied sRGB color.

Each component in the result is `sRGBToLinear(c * alpha)`, where `c` is the linear color.

func NRGBAToRGBA_PostAlpha

func NRGBAToRGBA_PostAlpha(col color.NRGBA) color.RGBA

NRGBAToRGBA_PostAlpha converts from non-premultiplied sRGB color to premultiplied sRGB color.

Each component in the result is `sRGBToLinear(c) * alpha`, where `c` is the linear color.

func RGBAToNRGBA

func RGBAToNRGBA(col color.RGBA) color.NRGBA

RGBAToNRGBA converts from premultiplied sRGB color to non-premultiplied sRGB color.

Types

type RGBA

type RGBA struct {
	R, G, B, A float32
}

RGBA is a 32 bit floating point linear premultiplied color space.

func LinearFromSRGB

func LinearFromSRGB(col color.NRGBA) RGBA

LinearFromSRGB converts from col in the sRGB colorspace to RGBA.

func (RGBA) Array

func (rgba RGBA) Array() [4]float32

Array returns rgba values in a [4]float32 array.

func (RGBA) Float32

func (col RGBA) Float32() (r, g, b, a float32)

Float32 returns r, g, b, a values.

func (RGBA) Luminance

func (col RGBA) Luminance() float32

Luminance calculates the relative luminance of a linear RGBA color. Normalized to 0 for black and 1 for white.

See https://www.w3.org/TR/WCAG20/#relativeluminancedef for more details

func (RGBA) Opaque

func (col RGBA) Opaque() RGBA

Opaque returns the color without alpha component.

func (RGBA) SRGB

func (col RGBA) SRGB() color.NRGBA

SRGBA converts from linear to sRGB color space.

Directories

Path Synopsis
Generate the colors for the colorx package.
Generate the colors for the colorx package.
List of Crayola crayon standard colors.
List of Crayola crayon standard colors.
List of named HTML colors.
List of named HTML colors.
The 954 most common RGB monitor colors, as defined by several hundred thousand participants in the xkcd color name survey..
The 954 most common RGB monitor colors, as defined by several hundred thousand participants in the xkcd color name survey..

Jump to

Keyboard shortcuts

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