Documentation
¶
Index ¶
- Constants
- Variables
- func Darken(colorString string) (string, error)
- func GradientToSVG(gradient Gradient) string
- func InterpolateHex(from, to color.NRGBA, fraction float64) string
- func IsGradient(color string) bool
- func IsThemeColor(colorString string) bool
- func IsURLGradientID(color string) bool
- func LinearGradientToSVG(gradient Gradient) string
- func LinearGradientVector(direction string) (x1, y1, x2, y2 float64, err error)
- func Luminance(colorString string) (float64, error)
- func LuminanceCategory(colorString string) (string, error)
- func PaintVisibleThroughout(raw string) bool
- func ParseRGBA(raw string) (color.NRGBA, bool)
- func RadialGradientToSVG(gradient Gradient) string
- func UniqueGradientID(cssGradient string) string
- func ValidColor(color string) bool
- type ColorStop
- type Gradient
- type RGB
Constants ¶
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 ¶
var ColorHexRegex = regexp.MustCompile(`^#(([0-9a-fA-F]{2}){3}|([0-9a-fA-F]){3})$`)
var GradientRegex = regexp.MustCompile(`^(linear|radial)-gradient\((.+)\)$`)
var NamedColors = []string{}/* 150 elements not displayed */
var URLGradientID = regexp.MustCompile(`^url\('#grad-[a-f0-9]{40}'\)$`)
Functions ¶
func GradientToSVG ¶
func InterpolateHex ¶ added in v0.10.0
InterpolateHex mixes sRGB channels with premultiplied alpha. Fading from transparent to a color increases its opacity without darkening it along the way.
func IsGradient ¶
func IsThemeColor ¶
func IsURLGradientID ¶
func LinearGradientToSVG ¶
func LinearGradientVector ¶ added in v0.10.0
LinearGradientVector returns endpoints in object-bounding-box coordinates. For malformed directions it also reports an error; the coordinates retain the historical SVG fallback for unrecognized direction words.
func LuminanceCategory ¶
func PaintVisibleThroughout ¶ added in v0.10.0
PaintVisibleThroughout reports whether a stroke can be visible along its entire length. A fade through an isolated transparent stop still qualifies. Gradients that hold zero alpha over an interval use plain crossings because a route-wide mask could otherwise erase a line beneath invisible paint.