Documentation
¶
Overview ¶
Package xcolor enables one to specify a color using color expression strings as used in the LaTeX package "xcolor".
The package employs its own internal structs for representing colors, and mainly uses the structs. It also supports conversion to values of the standard color.Color type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoColor ¶
GoColor converts a color expression to a color value of the standard color.Color type. Equivalent to Parse(expr).GoColor().
func LoadPreset ¶
LoadPreset loads a color name preset; the preset name "XXX" corresponds to the option "XXXnames" of the LaTeX xcolor package. The set names available are: "dvips", "svg".
Types ¶
type Color ¶
type Color interface { // Model tells the model of this color. Model() Model // Params returns the values of the numerical parameters for this color. Params() []float64 // Compl returns the complementary of this color. Compl() Color // Blend returns the blended color made of this and c. Blend(r float64, c Color) Color // Convert converts this color to another color model. Convert(m Model) Color // HtmlCode returns the HTML color literal for this color. HtmlCode() string // CssCode returns the CSS color literal for this color. CssCode() string // GoColor() convert to the Color value of standard color package. GoColor() color.Color // RGBA() is provided so that Color will satisfy color.Color. RGBA() (r, g, b, a uint32) fmt.Stringer // contains filtered or unexported methods }
Interface Color represents a color.
Note: although the type Color can be used as color.Color by itself, such use will be agnostic of the underlying color model, unless the program knows the xcolor package and treats its concrete types. On the other hand, the conversion using GoColor() will yield values of appropriate concrete types of 'image/color', namely, NRGBA, CMYK and Gray.