From 4f12f1441141ad361b02be34aa6c0b028b6d0e95 Mon Sep 17 00:00:00 2001 From: Codeberg Date: Tue, 28 May 2019 13:51:56 +0200 Subject: [PATCH] write alpha only for transparent colors --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index c619909..4372cd4 100644 --- a/main.go +++ b/main.go @@ -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) }