altcolor

package
v0.0.0-...-6905684 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2019 License: MIT Imports: 5 Imported by: 4

Documentation

Overview

Package altcolor includes useful color models absent in the standard library's "image/color" package. These are HSLA (Hue Saturation Lightness Alpha), HSVA (Hue Saturation Value Alpha) and HSIA (Hue Saturation Intensity/Brightness Alpha).

Index

Constants

This section is empty.

Variables

View Source
var (
	SHORT_HEX = regexp.MustCompile("#([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])([A-Fa-f0-9])?")
	LONG_HEX  = regexp.MustCompile("#([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})([A-Fa-f0-9]{2})?")

	RGB  = regexp.MustCompile("rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)")
	RGBA = regexp.MustCompile("rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)")
)
View Source
var HSIAModel color.Model = color.ModelFunc(hsiaModel)
View Source
var HSLAModel color.Model = color.ModelFunc(hslaModel)
View Source
var HSVAModel color.Model = color.ModelFunc(hsvaModel)

Functions

func Parse

func Parse(str string) color.Color

Types

type HSIA

type HSIA struct {
	H, S, I, A float64
}

HSIA represents a colour with hue, saturation, intensity and alpha channels. All values are represented as floating point numbers with hue taking a value between 0 and 360, and the rest between 0 and 1.

Sometimes called HSBA (Hue Saturation Brightness Alpha)

func (HSIA) RGBA

func (col HSIA) RGBA() (red, green, blue, alpha uint32)

type HSLA

type HSLA struct {
	H, S, L, A float64
}

HSLA represents a colour with hue, saturation, lightness and alpha channels. All values are represented as floating point numbers with hue taking a value between 0 and 360, and the rest between 0 and 1.

func (HSLA) RGBA

func (col HSLA) RGBA() (red, green, blue, alpha uint32)

BUG: Conversion is broken _somewhere_, check against IM results.

type HSVA

type HSVA struct {
	H, S, V, A float64
}

HSVA represents a colour with hue, saturation, value and alpha channels. All values are represented as floating point numbers with hue taking a value between 0 and 360, and the rest between 0 and 1.

func (HSVA) RGBA

func (col HSVA) RGBA() (red, green, blue, alpha uint32)

Jump to

Keyboard shortcuts

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