Implement tinting by icon content (config and documentation)

This commit is contained in:
o9000 2017-11-21 12:04:36 +01:00
parent e96e7fbee7
commit 67c3e47414
3 changed files with 7 additions and 3 deletions

View file

@ -119,6 +119,10 @@ The tint2 config file starts with the options defining background elements with
* `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:
```

View file

@ -353,7 +353,7 @@ void add_entry(char *key, char *value)
} 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.));
}

View file

@ -252,7 +252,7 @@ void config_write_backgrounds(FILE *fp)
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 @@ void add_entry(char *key, char *value)
} 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();
}