Skip to content

Commit

Permalink
Tweaked FRGBA constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
jphsd committed Sep 22, 2024
1 parent ba43f85 commit 8c88c67
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions color/frgba.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ type FRGBA struct {

// NewFRGBA returns a new FRGB using the supplied color.
func NewFRGBA(col color.Color) FRGBA {
if frgba, ok := col.(FRGBA); ok {
return FRGBA{frgba.R, frgba.G, frgba.B, frgba.A}
}
r, g, b, a := col.RGBA()
if a == 0 {
return FRGBA{0, 0, 0, 0}
Expand Down

0 comments on commit 8c88c67

Please sign in to comment.