func ColorChannelFromFloat(v float64) uint8 {
	return uint8(v * 255)
}
ColorChannelFromFloat returns a normalized byte from a given float value.
package drawing
import (
	"fmt"
	"strconv"
)
var (
	ColorTransparent = Color{}
	ColorWhite = Color{R: 255, G: 255, B: 255, A: 255}
	ColorBlack = Color{R: 0, G: 0, B: 0, A: 255}
	ColorRed = Color{R: 255, G: 0, B: 0, A: 255}
	ColorGreen = Color{R: 0, G: 255, B: 0, A: 255}
	ColorBlue = Color{R: 0, G: 0, B: 255, A: 255}
)
func parseHex(hex string) uint8 {
	v, _ := strconv.ParseInt(hex, 16, 16)
	return uint8(v)
}
func ColorFromHex(hex string) Color {
	var c Color
	if len(hex) == 3 {
		c.R = parseHex(string(hex[0])) * 0x11
		c.G = parseHex(string(hex[1])) * 0x11
		c.B = parseHex(string(hex[2])) * 0x11
	} else {
		c.R = parseHex(string(hex[0:2]))
		c.G = parseHex(string(hex[2:4]))
		c.B = parseHex(string(hex[4:6]))
	}
	c.A = 255
	return c
}
func ColorFromAlphaMixedRGBA(r, g, b, a uint32) Color {
	fa := float64(a) / 255.0
	var c Color
	c.R = uint8(float64(r) / fa)
	c.G = uint8(float64(g) / fa)
	c.B = uint8(float64(b) / fa)
	c.A = uint8(a | (a >> 8))
	return c
}