Add text colors for links (fixes #211)

This commit is contained in:
Sebastian Ramacher 2021-02-09 21:57:44 +01:00
parent 7d294ef91b
commit 5f3970fcdd
4 changed files with 21 additions and 7 deletions

View file

@ -43,6 +43,14 @@ General settings
:type: String
:default: #9FBC00
.. describe:: highlight-fg
Defines the color that is for text when highlighting parts of the document
(e.g.: numbers for links)
:type: String
:default: #FFFFFF
.. describe:: highlight-active-color
Defines the color that is used to show the current selected highlighted

View file

@ -57,6 +57,8 @@ cb_color_change(girara_session_t* session, const char* name,
const char* string_value = (const char*) value;
if (g_strcmp0(name, "highlight-color") == 0) {
parse_color(&zathura->ui.colors.highlight_color, string_value);
} else if (g_strcmp0(name, "highlight-fg") == 0) {
parse_color(&zathura->ui.colors.highlight_color_fg, string_value);
} else if (g_strcmp0(name, "highlight-active-color") == 0) {
parse_color(&zathura->ui.colors.highlight_color_active, string_value);
} else if (g_strcmp0(name, "recolor-darkcolor") == 0) {
@ -209,15 +211,17 @@ config_load_default(zathura_t* zathura)
int_value = 2000;
girara_setting_add(gsession, "jumplist-size", &int_value, INT, false, _("Number of positions to remember in the jumplist"), cb_jumplist_change, NULL);
girara_setting_add(gsession, "recolor-darkcolor", "#FFFFFF", STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
girara_setting_add(gsession, "recolor-lightcolor", "#000000", STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
girara_setting_add(gsession, "recolor-darkcolor", "#FFFFFF", STRING, false, _("Recoloring (dark color)"), cb_color_change, NULL);
girara_setting_add(gsession, "recolor-lightcolor", "#000000", STRING, false, _("Recoloring (light color)"), cb_color_change, NULL);
girara_setting_add(gsession, "highlight-color", NULL, STRING, false, _("Color for highlighting"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-color", "#9FBC00");
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
girara_setting_add(gsession, "highlight-fg", NULL, STRING, false, _("Foreground color for highlighting"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-fg", "#000000");
girara_setting_add(gsession, "highlight-active-color", NULL, STRING, false, _("Color for highlighting (active)"), cb_color_change, NULL);
girara_setting_set(gsession, "highlight-active-color", "#00BC00");
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
girara_setting_add(gsession, "render-loading-bg", NULL, STRING, false, _("'Loading ...' background color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-bg", "#FFFFFF");
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
girara_setting_add(gsession, "render-loading-fg", NULL, STRING, false, _("'Loading ...' foreground color"), cb_color_change, NULL);
girara_setting_set(gsession, "render-loading-fg", "#000000");
girara_setting_add(gsession, "index-fg", "#DDDDDD", STRING, true, _("Index mode foreground color"), NULL, NULL);

View file

@ -587,7 +587,8 @@ zathura_page_widget_draw(GtkWidget* widget, cairo_t* cairo)
cairo_fill(cairo);
/* draw text */
cairo_set_source_rgba(cairo, 0, 0, 0, 1);
const GdkRGBA color_fg = priv->zathura->ui.colors.highlight_color_fg;
cairo_set_source_rgba(cairo, color_fg.red, color_fg.green, color_fg.blue, transparency);
cairo_move_to(cairo, rectangle.x1 + 1, rectangle.y2 - 1);
char* link_number = g_strdup_printf("%i", priv->links.offset + ++link_counter);
cairo_show_text(cairo, link_number);

View file

@ -107,6 +107,7 @@ struct zathura_s
struct
{
GdkRGBA highlight_color; /**< Color for highlighting */
GdkRGBA highlight_color_fg; /**< Color for highlighting (foreground) */
GdkRGBA highlight_color_active; /** Color for highlighting */
GdkRGBA render_loading_bg; /**< Background color for render "Loading..." */
GdkRGBA render_loading_fg; /**< Foreground color for render "Loading..." */