mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
implement solid color rendering for swaybg
This commit is contained in:
parent
2e4ece65da
commit
98aa59fdda
10 changed files with 197 additions and 157 deletions
|
|
@ -97,3 +97,16 @@ pid_t get_parent_pid(pid_t child) {
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint32_t parse_color(const char *color) {
|
||||
int len = strlen(color);
|
||||
if (color[0] != '#' || (len != 7 && len != 9)) {
|
||||
sway_log(L_DEBUG, "Invalid color %s, defaulting to color 0xFFFFFFFF", color);
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
uint32_t res = (uint32_t)strtol(color + 1, NULL, 16);
|
||||
if (strlen(color) == 7) {
|
||||
res = (res << 8) | 0xFF;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue