| 124 static char *item_factory_translate_func (const char *path, gpointer func_data); |
124 static char *item_factory_translate_func (const char *path, gpointer func_data); |
| 125 |
125 |
| 126 static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) { |
126 static GdkColor *get_nick_color(GaimGtkConversation *gtkconv, const char *name) { |
| 127 static GdkColor col; |
127 static GdkColor col; |
| 128 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); |
128 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); |
| |
129 float scale; |
| 129 |
130 |
| 130 col = nick_colors[g_str_hash(name) % NUM_NICK_COLORS]; |
131 col = nick_colors[g_str_hash(name) % NUM_NICK_COLORS]; |
| |
132 scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) * |
| |
133 (LUMINANCE(style->white)/MAX(MAX(col.red, col.blue), col.green))); |
| 131 |
134 |
| 132 /* The colors are chosen to look fine on white; we should never have to darken */ |
135 /* The colors are chosen to look fine on white; we should never have to darken */ |
| 133 if (scale > 1) { |
136 if (scale > 1) { |
| 134 float scale = ((1-(LUMINANCE(style->base[GTK_STATE_NORMAL]) / LUMINANCE(style->white))) * |
|
| 135 (LUMINANCE(style->white)/MAX(MAX(col.red, col.blue), col.green))); |
|
| 136 col.red *= scale; |
137 col.red *= scale; |
| 137 col.green *= scale; |
138 col.green *= scale; |
| 138 col.blue *= scale; |
139 col.blue *= scale; |
| 139 } |
140 } |
| 140 |
141 |