about summary refs log tree commit diff
path: root/exwm-core.el
diff options
context:
space:
mode:
Diffstat (limited to 'exwm-core.el')
-rw-r--r--exwm-core.el9
1 files changed, 9 insertions, 0 deletions
diff --git a/exwm-core.el b/exwm-core.el
index 7e37a71b6c0e..553fb4b4e3a7 100644
--- a/exwm-core.el
+++ b/exwm-core.el
@@ -184,6 +184,15 @@ least SECS seconds later."
           (if mouse-autoselect-window
               xcb:EventMask:EnterWindow 0)))
 
+(defun exwm--color->pixel (color)
+  "Convert COLOR to PIXEL (index in TrueColor colormap)."
+  (when (and color
+             (eq (x-display-visual-class) 'true-color))
+    (let ((rgb (x-color-values color)))
+      (logior (lsh (lsh (pop rgb) -8) 16)
+              (lsh (lsh (pop rgb) -8) 8)
+              (lsh (pop rgb) -8)))))
+
 ;; Internal variables
 (defvar-local exwm--id nil)               ;window ID
 (defvar-local exwm--configurations nil)   ;initial configurations.