aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-theme-adium.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-02 19:36:42 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-02 20:52:29 +0800
commit715bb21b4598091c2dac0ebf94b3d744056d01e6 (patch)
tree669cb8f99cf55e4bf7b3bd042b0fb099d916bf5c /libempathy-gtk/empathy-theme-adium.c
parentfdae42d539623655e9e496c80392164bc3c0f263 (diff)
downloadgsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.tar
gsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.tar.gz
gsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.tar.bz2
gsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.tar.lz
gsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.tar.xz
gsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.tar.zst
gsoc2013-empathy-715bb21b4598091c2dac0ebf94b3d744056d01e6.zip
theme-adium: implement %senderColor% (#541632)
Diffstat (limited to 'libempathy-gtk/empathy-theme-adium.c')
-rw-r--r--libempathy-gtk/empathy-theme-adium.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/libempathy-gtk/empathy-theme-adium.c b/libempathy-gtk/empathy-theme-adium.c
index 7218664a0..c15373146 100644
--- a/libempathy-gtk/empathy-theme-adium.c
+++ b/libempathy-gtk/empathy-theme-adium.c
@@ -349,6 +349,32 @@ theme_adium_match_with_format (const gchar **str,
return TRUE;
}
+/* List of colors used by %senderColor%. Copied from
+ * adium/Frameworks/AIUtilities\ Framework/Source/AIColorAdditions.m
+ */
+static gchar *colors[] = {
+ "aqua", "aquamarine", "blue", "blueviolet", "brown", "burlywood", "cadetblue",
+ "chartreuse", "chocolate", "coral", "cornflowerblue", "crimson", "cyan",
+ "darkblue", "darkcyan", "darkgoldenrod", "darkgreen", "darkgrey", "darkkhaki",
+ "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred",
+ "darksalmon", "darkseagreen", "darkslateblue", "darkslategrey",
+ "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgrey",
+ "dodgerblue", "firebrick", "forestgreen", "fuchsia", "gold", "goldenrod",
+ "green", "greenyellow", "grey", "hotpink", "indianred", "indigo", "lawngreen",
+ "lightblue", "lightcoral",
+ "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen",
+ "lightskyblue", "lightslategrey", "lightsteelblue", "lime", "limegreen",
+ "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid",
+ "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen",
+ "mediumturquoise", "mediumvioletred", "midnightblue", "navy", "olive",
+ "olivedrab", "orange", "orangered", "orchid", "palegreen", "paleturquoise",
+ "palevioletred", "peru", "pink", "plum", "powderblue", "purple", "red",
+ "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen",
+ "sienna", "silver", "skyblue", "slateblue", "slategrey", "springgreen",
+ "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet",
+ "yellowgreen",
+};
+
static void
theme_adium_append_html (EmpathyThemeAdium *theme,
const gchar *func,
@@ -384,11 +410,14 @@ theme_adium_append_html (EmpathyThemeAdium *theme,
} else if (theme_adium_match (&cur, "%sender%")) {
replace = name;
} else if (theme_adium_match (&cur, "%senderColor%")) {
- /* FIXME: A color derived from the user's name. If a
- * colon separated list of HTML colors is at
+ /* A color derived from the user's name.
+ * FIXME: If a colon separated list of HTML colors is at
* Incoming/SenderColors.txt it will be used instead of
* the default colors.
*/
+ guint hash = g_str_hash (contact_id);
+
+ replace = colors[hash % G_N_ELEMENTS (colors)];
} else if (theme_adium_match (&cur, "%senderStatusIcon%")) {
/* FIXME: The path to the status icon of the sender
* (available, away, etc...)