summaryrefslogtreecommitdiff
path: root/drw/x.go
diff options
context:
space:
mode:
Diffstat (limited to 'drw/x.go')
-rw-r--r--drw/x.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/drw/x.go b/drw/x.go
index 1806410..c004d78 100644
--- a/drw/x.go
+++ b/drw/x.go
@@ -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
}