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

View File

@ -211,6 +211,9 @@ func (c *RGB) withAlpha(alpha float64) *RGB {
} }
func (c *RGB) html() string { 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) return fmt.Sprintf("#%02x%02x%02x%02x", c.r, c.g, c.b, c.a)
} }