with alpha.

This commit is contained in:
Will Charczuk 2016-07-09 11:26:28 -07:00
parent 1357950324
commit 59a5b2cbac

View File

@ -78,6 +78,16 @@ func (c Color) IsTransparent() bool {
return c.A == 0 return c.A == 0
} }
// WithAlpha returns a copy of the color with a given alpha.
func (c Color) WithAlpha(a uint8) Color {
return Color{
R: c.R,
G: c.G,
B: c.B,
A: a,
}
}
// String returns a css string representation of the color. // String returns a css string representation of the color.
func (c Color) String() string { func (c Color) String() string {
fa := float64(c.A) / float64(255) fa := float64(c.A) / float64(255)