running = false;
}
}
+
+/* Adapted from i3wm */
+uint32_t get_color_pixel(const char *color)
+{
+ unsigned int red, green, blue;
+ if (sscanf(color + 1, "%02x%02x%02x", &red, &green, &blue) == 3) {
+ /* We set the first 8 bits high to have 100% opacity in case of a 32 bit
+ * color depth visual. */
+ return (0xFF << 24) | (red << 16 | green << 8 | blue);
+ } else {
+ return screen->black_pixel;
+ }
+}
void cleanup(void);
bool check_connection (xcb_connection_t *dpy);
void sig_handler(int sig);
+uint32_t get_color_pixel(const char *color);
#endif
return size;
}
-/* Adapted from i3wm */
-uint32_t get_color_pixel(const char *color)
-{
- unsigned int red, green, blue;
- if (sscanf(color + 1, "%02x%02x%02x", &red, &green, &blue) == 3) {
- /* We set the first 8 bits high to have 100% opacity in case of a 32 bit
- * color depth visual. */
- return (0xFF << 24) | (red << 16 | green << 8 | blue);
- } else {
- return screen->black_pixel;
- }
-}
-
bool is_hex_color(const char *color)
{
if (color[0] != '#' || strlen(color) != 7) {
char *mktempfifo(const char *template);
int asprintf(char **buf, const char *fmt, ...);
int vasprintf(char **buf, const char *fmt, va_list args);
-uint32_t get_color_pixel(const char *color);
bool is_hex_color(const char *color);
#endif