Implement tinting by icon content (config and documentation)
o9000 mrovi9000@gmail.com
3 files changed,
7 insertions(+),
3 deletions(-)
M
doc/tint2.md
→
doc/tint2.md
@@ -119,6 +119,10 @@ * `border_color_pressed = color opacity` (default: same as `border_color_hover`) *(since 0.12.3)*
* `color` is specified in hex RGB, e.g. #ff0000 is red * `opacity` varies from (0 to 100), where 0 is fully transparent, 100 is fully opaque + * `border_content_tint_weight = integer` : Mixes the border color with the content color (for tasks, this is the average color of the window icon). Values must be between 0 (no mixing) and 100 (fully replaces the color). *(since 16.0)* + + * `background_content_tint_weight = integer` : Mixes the background color with the content color (for tasks, this is the average color of the window icon). Values must be between 0 (no mixing) and 100 (fully replaces the color). *(since 16.0)* + You can define as many backgrounds as you want. For example, the following config defines two backgrounds: ```
M
src/config.c
→
src/config.c
@@ -353,7 +353,7 @@ bg->gradients[MOUSE_DOWN] = &g_array_index(gradients, GradientClass, id);
} else if (strcmp(key, "border_content_tint_weight") == 0) { Background *bg = &g_array_index(backgrounds, Background, backgrounds->len - 1); bg->border_content_tint_weight = MAX(0.0, MIN(1.0, atoi(value) / 100.)); - } else if (strcmp(key, "fill_content_tint_weight") == 0) { + } else if (strcmp(key, "background_content_tint_weight") == 0) { Background *bg = &g_array_index(backgrounds, Background, backgrounds->len - 1); bg->fill_content_tint_weight = MAX(0.0, MIN(1.0, atoi(value) / 100.)); }
M
src/tint2conf/properties_rw.c
→
src/tint2conf/properties_rw.c
@@ -252,7 +252,7 @@ strcat(sides, "R");
fprintf(fp, "border_sides = %s\n", sides); fprintf(fp, "border_content_tint_weight = %d\n", (int)(border_weight)); - fprintf(fp, "fill_content_tint_weight = %d\n", (int)(fill_weight)); + fprintf(fp, "background_content_tint_weight = %d\n", (int)(fill_weight)); config_write_color(fp, "background_color", *fillColor, fillOpacity); config_write_color(fp, "border_color", *borderColor, borderOpacity);@@ -1242,7 +1242,7 @@ background_force_update();
} else if (strcmp(key, "border_content_tint_weight") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_border_content_tint_weight), atoi(value)); background_force_update(); - } else if (strcmp(key, "fill_content_tint_weight") == 0) { + } else if (strcmp(key, "background_content_tint_weight") == 0) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(background_fill_content_tint_weight), atoi(value)); background_force_update(); }