Standardized GtkCellRendererText foreground bindings to use the palette foreground property macro across user list, notify list, and DCC views (GTK2/GTK3 aware).

Generated GTK3 caret-color CSS using GdkRGBA string conversion instead of manual RGB math for input styling.
Simplified palette RGB16 parsing by building a GdkRGBA-compatible color string before parsing.
This commit is contained in:
2026-01-22 22:25:26 -07:00
parent 61669f6b98
commit 9959cf1f24
5 changed files with 11 additions and 27 deletions

View File

@@ -2543,16 +2543,15 @@ setup_apply_to_sess (session_gui *gui)
if (prefs.hex_gui_input_style)
{
#if GTK_CHECK_VERSION(3,0,0)
guint8 red = (guint8) CLAMP (colors[COL_FG].red * 255.0 + 0.5, 0.0, 255.0);
guint8 green = (guint8) CLAMP (colors[COL_FG].green * 255.0 + 0.5, 0.0, 255.0);
guint8 blue = (guint8) CLAMP (colors[COL_FG].blue * 255.0 + 0.5, 0.0, 255.0);
char buf[128];
GtkCssProvider *provider = gtk_css_provider_new ();
GtkStyleContext *context;
char *color_string = gdk_rgba_to_string (&colors[COL_FG]);
g_snprintf (buf, sizeof (buf), ".zoitechat-inputbox { caret-color: #%02x%02x%02x; }",
red, green, blue);
g_snprintf (buf, sizeof (buf), ".zoitechat-inputbox { caret-color: %s; }",
color_string);
gtk_css_provider_load_from_data (provider, buf, -1, NULL);
g_free (color_string);
context = gtk_widget_get_style_context (gui->input_box);
gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider),