write alpha only for transparent colors

This commit is contained in:
Codeberg 2019-05-28 13:51:56 +02:00 committed by Holger Waechtler
parent 526b5adead
commit 4f12f14411
1 changed files with 3 additions and 0 deletions

View File

@ -211,6 +211,9 @@ func (c *RGB) withAlpha(alpha float64) *RGB {
}
func (c *RGB) html() string {
if (c.a == 255) {
return fmt.Sprintf("#%02x%02x%02x", c.r, c.g, c.b)
}
return fmt.Sprintf("#%02x%02x%02x%02x", c.r, c.g, c.b, c.a)
}