You are not logged in.
I have faced the issue with chat colors in Jabber conference.
Pidgin applied way too bright colors to nicks and some of them become unreadable on the white background.
The solution is actually very simple, we should not allow Pidgin to use colors like FF0000, 00FF00 and so on.
I modified the source code, here is a patch:
--- gtkconv.c 2014-11-23 19:41:26.000000000 +0300
+++ gtkconv-new.c 2015-01-18 23:50:46.000000000 +0300
@@ -171,7 +171,7 @@
static const GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name)
{
- static GdkColor col;
+ static GdkColor col;// col ={0, 0x0000, 0x0000, 0x0000}; //0xffff
GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
float scale;
@@ -185,7 +185,9 @@
col.green *= scale;
col.blue *= scale;
}
-
+ col.red = MIN(col.red,32767);
+ col.green = MIN(col.green,32767);
+ col.blue = MIN(col.blue,32767);
return &col;
}
Call it from PKGBUILD:
prepare() {
cd "$srcdir/$pkgname-$pkgver"
# Use Python 2
sed -i 's/env python$/&2/' */plugins/*.py \
libpurple/purple-{remote,notifications-example,url-handler}
# darken nicks patch
patch pidgin/gtkconv.c ../../gtkconv-darkenchatnicks.diff
}
That's it. Rebuild Pidgin and you will not deal with extremely bright colors in chat.
Maybe it is a good idea to include this patch to our "official" PKGBUILD.
Offline
You should submit this upstream.
Moving to Community Contributions...
Offline
Hi again, I improved the patch code and uploaded it to github.
Now the patch looks as follows:
--- gtkconv-ori.c 2016-06-19 08:33:11.000000000 +0300
+++ gtkconv.c 2016-07-23 00:56:07.893682523 +0300
@@ -174,6 +174,8 @@
static GdkColor col;
GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml);
float scale;
+ float percent;
+ int halfcolor;
col = nick_colors[g_str_hash(name) % nbr_nick_colors];
scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) *
@@ -186,6 +188,17 @@
col.blue *= scale;
}
+ halfcolor = G_MAXUINT16/2;
+
+ percent = (col.red*100)/G_MAXUINT16;
+ col.red = (percent*halfcolor)/100;
+
+ percent = (col.green*100)/G_MAXUINT16;
+ col.green = (percent*halfcolor)/100;
+
+ percent = (col.blue*100)/G_MAXUINT16;
+ col.blue = (percent*halfcolor)/100;
+
return &col;
}
This code reduces all color channels proportionally to values calculated by pidgin.
I uploaded everything to github here: https://github.com/tkaserg/pidgin-less- … ick-colors
Tested against the latest version 2.11.0-1 (as of this writing), everything works fine here.
Build it as follows:
makepkg -si --skippgpcheck
Last edited by hb860 (2016-07-22 22:33:39)
Offline