summaryrefslogtreecommitdiff
path: root/drw/x.go
diff options
context:
space:
mode:
authorhhvn <dev@hhvn.uk>2023-11-19 13:29:12 +0000
committerhhvn <dev@hhvn.uk>2023-11-19 13:30:04 +0000
commit3ad7ace9c1cc88b4ec4eed8c4eee801e1f659110 (patch)
treefb6fe064518626fd44783ab65a1f1c4acc8b1cb3 /drw/x.go
parent19781aeb974bd20c421a6b4677ffab348df8faf9 (diff)
Color blending
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
}