diff options
Diffstat (limited to 'drw/x.go')
| -rw-r--r-- | drw/x.go | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -77,6 +77,24 @@ func int2rgb(argb uint32) (color.RGBA) { A: uint8((argb & 0xff000000) >> 24) } } +func rgb2int(c color.Color) uint32 { + r, g, b, a := c.RGBA() + + r /= 256 + g /= 256 + b /= 256 + a /= 256 + + var ret uint32 = 0 + + ret |= (a << 24) + ret |= (r << 16) + ret |= (g << 8) + ret |= b + + return ret +} + type Window struct { id xproto.Window } |