X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libi3%2Fget_colorpixel.c;h=f81ea6c21b378a961c8f2872553e46b0918ab440;hb=a172168e61e37a1c4415f4abfd5ece6c5293dadf;hp=b093594e10484d74677752756798062b5178719b;hpb=e7761a342bcbb6668e9cc710570f55be623c7373;p=i3%2Fi3 diff --git a/libi3/get_colorpixel.c b/libi3/get_colorpixel.c index b093594e..f81ea6c2 100644 --- a/libi3/get_colorpixel.c +++ b/libi3/get_colorpixel.c @@ -2,11 +2,12 @@ * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager - * © 2009-2012 Michael Stapelberg and contributors (see also: LICENSE) + * © 2009 Michael Stapelberg and contributors (see also: LICENSE) * */ #include #include +#include #include "libi3.h" @@ -25,14 +26,13 @@ * */ uint32_t get_colorpixel(const char *hex) { - char strgroups[3][3] = {{hex[1], hex[2], '\0'}, - {hex[3], hex[4], '\0'}, - {hex[5], hex[6], '\0'}}; + char strgroups[3][3] = { + {hex[1], hex[2], '\0'}, + {hex[3], hex[4], '\0'}, + {hex[5], hex[6], '\0'}}; uint8_t r = strtol(strgroups[0], NULL, 16); uint8_t g = strtol(strgroups[1], NULL, 16); uint8_t b = strtol(strgroups[2], NULL, 16); - /* We set the first 8 bits high to have 100% opacity in case of a 32 bit - * color depth visual. */ return (0xFF << 24) | (r << 16 | g << 8 | b); }