color

package
v0.0.0-...-a14702c Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoundToGamutXY

func BoundToGamutXY(x, y, rx, ry, gx, gy, bx, by float64) (cx, cy float64)

BoundToGamutXY compares the point x,y to the triangle formed by rx,ry, gx,gy, bx,by. If the point falls within the triangle, x and y are returned. If the point falls outside the triangle, the x and y values of the nearest point on the triangle are returned.

func HSVtoRGB

func HSVtoRGB(h, s, v float64) (r, g, b float64)

HSVtoRGB converts hue, saturation and brightness values on the range of 0.0 to 1.0 to RGB floating point values on the range of 0.0 to 1.0

func RGBtoHSV

func RGBtoHSV(r, g, b float64) (h, s, v float64)

RGBtoHSV converts red, green, and blue floating point values on the range 0.0 to 1.0 to hue, saturation and brightness values on the range 0.0 to 1.0

func RGBtoXYBPhilipsWideRGBD65

func RGBtoXYBPhilipsWideRGBD65(r, g, b float64) (x, y, bri float64)

RGBtoXYBPhilipsWideRGBD65 converts red, green, and blue floating point values on the range 0.0 to 1.0 to CIE colorspace x, y, and brightness values on the range 0.0 to 1.0 using Philips Wide RGB D65 conversion.

func XYBtoRGBPhilipsWideRGBD65

func XYBtoRGBPhilipsWideRGBD65(x, y, bri float64) (r, g, b float64)

XYBtoRGBPhilipsWideRGBD65 converts CIE colorspace x, y, and brightness values on the range 0.0 to 1.0 to red, green, and blue floating point values on the range 0.0 to 1.0 using Philips Wide RGB D65 conversion.

Types

type Color

type Color uint32

Color is a KRGB color value packed in a uint32.

func HSVf

func HSVf(h, s, v float64) (c Color)

HSVf converts hue, saturation and brightness values on the range of 0.0 to 1.0 to a Color

func Lookup

func Lookup(s string) (Color, bool)

Lookup returns a Color by name from the library if found.

func Parse

func Parse(s string) (Color, error)

Parse converts s to a Color by named color value, RGB 6 digit hex, or KRGB 8 digit hex

func RGBf

func RGBf(r, g, b float64) (c Color)

RGBf converts red, green, and blue float64 values on the range of 0.0 to 1.0 to a Color. The inputs are clamped to the range of 0.0 to 1.0

func Seq

func Seq(first, last Color, num int) []Color

Seq returns num colors from first to last by interpolating in HSV colorspace

func XYBfPhilipsWideRGBD65

func XYBfPhilipsWideRGBD65(x, y, bri float64) Color

XYBfPhilipsWideRGBD65 converts x, y, and brightness values on the range 0.0 to 1.0 to a Color using Philips Wide RGB D65 conversion.

func (Color) HSVf

func (c Color) HSVf() (h, s, v float64)

HSVf returns the hue, saturation and brightness components as float64 on the range 0.0 to 1.0

func (Color) HasK

func (c Color) HasK() bool

HasK returns true if C has a fourth component which may be interpreted as color temperature.

func (Color) Kf

func (c Color) Kf() float64

Kf returns the color temperature component as a float on the range 0.0 to 1.0

func (Color) RGBf

func (c Color) RGBf() (r, g, b float64)

RGBf returns the red, green, and blue components as float64 on the range 0.0 to 1.0

func (Color) String

func (c Color) String() string

func (Color) Strip

func (c Color) Strip() Color

Strip returns a new Color with the brightness component maximized.

func (Color) TermBG

func (c Color) TermBG(s string) string

TermBG wraps s to set the terminal background

func (Color) TermFG

func (c Color) TermFG(s string) string

TermFG wraps s to set the terminal foreground color

func (Color) XYBfPhilipsWideRGBD65

func (c Color) XYBfPhilipsWideRGBD65() (x, y, bri float64)

XYBfPhilipsWideRGBD65 returns x, y, and brightness values on the range 0.0 to 1.0 using Philips Wide RGB D65 conversion.

type ListItem

type ListItem struct {
	Name  string
	Color Color
}

func List

func List(match func(string) bool) []ListItem

func ListContains

func ListContains(substr string) []ListItem

func ListMatch

func ListMatch(pattern string) ([]ListItem, error)

func ListPrefix

func ListPrefix(prefix string) []ListItem

Jump to

Keyboard shortcuts

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