diff --git a/image/color/color.go b/image/color/color.go index b24632b..d763713 100644 --- a/image/color/color.go +++ b/image/color/color.go @@ -7,3 +7,14 @@ func Transparent (c color.Color) bool { _, _, _, a := c.RGBA() return a != 0xFFFF } + +// ToRGBA converts any color to a color.RGBA value. +func ToRGBA (c color.Color) color.RGBA { + r, g, b, a := c.RGBA() + return color.RGBA { + uint8(r >> 8), + uint8(g >> 8), + uint8(b >> 8), + uint8(a >> 8), + } +}