color

package
v0.0.0-...-c67427c Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConvertibleColor

type ConvertibleColor interface {
	// HSV returns Hue and Saturation, converted from an internal format if required.
	HSV() (float64, float64, float64)
	// XYY returns X and Y in the CIE 1931 colour space, converted from an internal format if required.
	XYY() (float64, float64, float64)
	// RGB returns colour using 8 bit values, converted from an internal format if required.
	RGB() (uint8, uint8, uint8)
	// NativeColorspace returns the native colour space of the colour.
	NativeColorspace() NativeColorspace
}

ConvertibleColor is an interface that allows acceptance of a color implementation that supports modes required by a device.

type HSVColor

type HSVColor struct {
	Hue   float64
	Sat   float64
	Value float64
}

func (HSVColor) HSV

func (c HSVColor) HSV() (float64, float64, float64)

func (HSVColor) NativeColorspace

func (c HSVColor) NativeColorspace() NativeColorspace

func (HSVColor) RGB

func (c HSVColor) RGB() (uint8, uint8, uint8)

func (HSVColor) XYY

func (c HSVColor) XYY() (float64, float64, float64)

type NativeColorspace

type NativeColorspace uint8

NativeColorspace describes the native color space of a convertible color.

const (
	// HueSat the color is represented as Hue and saturation of the sRGB colorspace.
	HueSat NativeColorspace = 0
	// XYY the color is represented as the XYY coordinates fo the CIE 1931 colorspace.
	XYY NativeColorspace = 1
	// SRGB the color is represented as red, green and blue in the screen colorspace.
	SRGB NativeColorspace = 2
)

type SRGBColor

type SRGBColor struct {
	R uint8
	G uint8
	B uint8
}

func (SRGBColor) HSV

func (c SRGBColor) HSV() (float64, float64, float64)

func (SRGBColor) NativeColorspace

func (c SRGBColor) NativeColorspace() NativeColorspace

func (SRGBColor) RGB

func (c SRGBColor) RGB() (uint8, uint8, uint8)

func (SRGBColor) XYY

func (c SRGBColor) XYY() (float64, float64, float64)

type XYColor

type XYColor struct {
	X  float64
	Y  float64
	Y2 float64
}

func (XYColor) HSV

func (c XYColor) HSV() (float64, float64, float64)

func (XYColor) NativeColorspace

func (c XYColor) NativeColorspace() NativeColorspace

func (XYColor) RGB

func (c XYColor) RGB() (uint8, uint8, uint8)

func (XYColor) XYY

func (c XYColor) XYY() (float64, float64, float64)

Jump to

Keyboard shortcuts

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