color

package
v0.6.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: MPL-2.0 Imports: 11 Imported by: 8

Documentation

Index

Constants

View Source
const (
	N1 = "N1" // foreground color
	N2 = "N2"
	N3 = "N3"
	N4 = "N4"
	N5 = "N5"
	N6 = "N6"
	N7 = "N7" // background color

	// Base Colors: used for containers
	B1 = "B1"
	B2 = "B2"
	B3 = "B3"
	B4 = "B4"
	B5 = "B5"
	B6 = "B6"

	// Alternative colors A
	AA2 = "AA2"
	AA4 = "AA4"
	AA5 = "AA5"

	// Alternative colors B
	AB4 = "AB4"
	AB5 = "AB5"

	// Special
	Empty = ""
	None  = "none"
)

Variables

View Source
var ColorHexRegex = regexp.MustCompile(`^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$`)
View Source
var GradientRegex = regexp.MustCompile(`^(linear|radial)-gradient\((.+)\)$`)
View Source
var NamedColors = []string{}/* 150 elements not displayed */

Functions

func Darken

func Darken(colorString string) (string, error)

func GradientToSVG added in v0.6.7

func GradientToSVG(gradient Gradient) string

func IsGradient added in v0.6.7

func IsGradient(color string) bool

func IsThemeColor added in v0.2.1

func IsThemeColor(colorString string) bool

func LinearGradientToSVG added in v0.6.7

func LinearGradientToSVG(gradient Gradient) string

func Luminance added in v0.2.1

func Luminance(colorString string) (float64, error)

func LuminanceCategory added in v0.2.1

func LuminanceCategory(colorString string) (string, error)

func RadialGradientToSVG added in v0.6.7

func RadialGradientToSVG(gradient Gradient) string

func UniqueGradientID added in v0.6.7

func UniqueGradientID(cssGradient string) string

func ValidColor added in v0.6.7

func ValidColor(color string) bool

Types

type ColorStop added in v0.6.7

type ColorStop struct {
	Color    string
	Position string
}

type Gradient added in v0.6.7

type Gradient struct {
	Type       string
	Direction  string
	ColorStops []ColorStop
	ID         string
}

func ParseGradient added in v0.6.7

func ParseGradient(cssGradient string) (Gradient, error)

type RGB added in v0.2.2

type RGB struct {
	Red   uint8
	Green uint8
	Blue  uint8
}

func Name2RGB added in v0.2.2

func Name2RGB(name string) RGB

func (*RGB) IsLight added in v0.2.2

func (c *RGB) IsLight() bool

https://github.com/go-playground/colors/blob/main/rgb.go#L89

Jump to

Keyboard shortcuts

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