You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
417 B
16 lines
417 B
package state
|
|
|
|
// ColorFromInt decodes a packed uint32 into a hex color.
|
|
func ColorFromInt(value uint32) Color {
|
|
return Color{
|
|
R: uint8((value >> 24) & 0xFF),
|
|
G: uint8((value >> 16) & 0xFF),
|
|
B: uint8((value >> 8) & 0xFF),
|
|
A: uint8((value >> 0) & 0xFF),
|
|
}
|
|
}
|
|
|
|
// ToInt packs a hex color into a uint32.
|
|
func (c Color) ToInt() uint32 {
|
|
return uint32(c.R)<<24 | uint32(c.G)<<16 | uint32(c.B)<<8 | uint32(c.A)
|
|
}
|
|
|