fix: correct bug label color conversion
Amolith
and
Crush
created 2 weeks ago
Remove unnecessary 16-bit to 8-bit channel conversion in
labelToWebLabel. The RGBA() method already returns proper 8-bit
values, not 16-bit as previously assumed.
Co-Authored-By: Crush <crush@charm.land>
Change summary
pkg/web/webui_bugs.go | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
Detailed changes
@@ -289,13 +289,9 @@ func findBugByHash(rc *cache.RepoCache, hash string) (*cache.BugCache, error) {
func labelToWebLabel(label common.Label) Label {
rgba := label.Color().RGBA()
- // RGBA() returns 16-bit channels (0-65535), convert to 8-bit (0-255)
- r8 := uint8(rgba.R >> 8)
- g8 := uint8(rgba.G >> 8)
- b8 := uint8(rgba.B >> 8)
return Label{
Name: label.String(),
- Color: fmt.Sprintf("#%02x%02x%02x", r8, g8, b8),
+ Color: fmt.Sprintf("#%02x%02x%02x", rgba.R, rgba.G, rgba.B),
}
}