Documentation ¶
Index ¶
- Variables
- type Color
- func (color *Color) CMYKA() (c, m, y, k, a float64)
- func (color *Color) CMYKAWhole() (c, m, y, k, a uint8)
- func (color Color) Equal(c Color) bool
- func (color *Color) HSLA() (h, s, l, a float64)
- func (color *Color) HSLAWhole() (h uint16, s, l, a uint8)
- func (color *Color) MarshalJSON() ([]byte, error)
- func (color *Color) MarshalText() ([]byte, error)
- func (color *Color) RGBA() (r, g, b, a uint8)
- func (color Color) String() string
- func (color *Color) UnmarshalJSON(b []byte) (err error)
- func (color *Color) UnmarshalText(d []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrorInvalidColor = errors.New("invalid color")
)
Functions ¶
This section is empty.
Types ¶
type Color ¶
type Color struct {
Red, Green, Blue, Alpha uint8
}
Color represents a color with 8 bits allocated to each of red, green, blue, alpha
func ParseCMYKA ¶
func ParseCMYKAWhole ¶
func ParseHSLAWhole ¶
ParseHSLAWhole parses whole numbers instead of doubles representing the h, s, l, a values. h (0-360), s (0-100), l (0-100), a (0-100)
func ParseInt64 ¶ added in v0.1.0
ParseInt64 converts an int64 into a color. For example, 0xffffff
func ParseString ¶
ParseString parses a hex color. Supports the formats #000000, #00000000 (with alpha)
func (*Color) CMYKAWhole ¶
func (*Color) HSLA ¶
HSLA converts a color to its hue, saturation, lightness and alpha parts. h (0.0-360.0), s (0.0-1.0), l (0.0-1.0), a (0.0-1.0)
func (*Color) MarshalJSON ¶
func (*Color) MarshalText ¶ added in v0.1.0
func (*Color) UnmarshalJSON ¶
func (*Color) UnmarshalText ¶ added in v0.1.0
Click to show internal directories.
Click to hide internal directories.