hsl

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Color

type Color struct {
	// H is Hue in degrees [0, 360)
	H float64
	// S Saturation [0, 1]
	S float64
	// L Lightness [0, 1]
	L float64
}

Color represents a color in the HSL colorspace. Hue (H) is in degrees [0, 360], Saturation (S) and Lightness (L) are in [0.0, 1.0].

func MustHexHSL

func MustHexHSL(hexstr string) *Color

func NewHSL

func NewHSL(h, s, l float64) *Color

func NewHexHSL

func NewHexHSL(hexstr string) (*Color, error)

func (*Color) B

func (clr *Color) B() uint8

B returns the blue component of the HSL color.

func (*Color) G

func (clr *Color) G() uint8

G returns the green component of the HSL color.

func (*Color) Hex

func (clr *Color) Hex() string

Hex returns the hex color string representation (e.g., "#ffcc00") of the HSL color.

func (*Color) HexString

func (clr *Color) HexString() string

HexString is an alias for Hex().

func (*Color) R

func (clr *Color) R() uint8

R returns the red component of the HSL color.

func (*Color) RGB

func (clr *Color) RGB() (r, g, b uint8)

RGB returns the red, green, and blue components of the HSL color.

func (*Color) SetHex

func (clr *Color) SetHex(hex string) error

SetHex parses a hex color string and sets the HSL values accordingly.

func (*Color) SetRGB

func (clr *Color) SetRGB(r, g, b uint8)

SetRGB converts an RGB color to HSL and assigns the result to the Color receiver.

Jump to

Keyboard shortcuts

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