Documentation ¶
Index ¶
- Variables
- func Rmh(s string) (string, bool)
- type Color
- func (c Color) Hex(noAlpha ...bool) string
- func (c Color) HexA() string
- func (c Color) IsValid() bool
- func (c Color) RGBA() (r, g, b, a uint32)
- func (c Color) Shade(percent float64) (Color, error)
- func (c Color) Shades(n int) ([]Color, error)
- func (c Color) Subtract(c2 Color) (Color, error)
- func (c Color) Tint(percent float64) (Color, error)
- func (c Color) Tints(n int) ([]Color, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( White = RGB(255, 255, 255) Black = RGB(0, 0, 0) )
View Source
var (
ErrInvalid = func(c Color) error { return fmt.Errorf("invalid color: %v", c) }
)
Functions ¶
Types ¶
type Color ¶
type Color struct {
R, G, B, A uint32
}
func (Color) Hex ¶
Hex returns the hex representation of the color Note that it always begins with a hash Hex does not return the alpha channel if Color.A != 255 unless the first value of noAlpha is true
Example ¶
c := RGB(255, 255, 255) fmt.Println(c.Hex())
Output: #ffffff
func (Color) RGBA ¶
Example ¶
c := White r, g, b, a := c.RGBA() fmt.Println(r, g, b, a)
Output: 255 255 255 255
Click to show internal directories.
Click to hide internal directories.