[gnome-builder] colorpicker: allow color name changes from colorpicker UI
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] colorpicker: allow color name changes from colorpicker UI
- Date: Tue, 1 Nov 2016 15:59:19 +0000 (UTC)
commit 442948191cf5c01dc00005a4e58a5946df5fed72
Author: Sebastien Lafargue <slafargue gnome org>
Date: Tue Nov 1 16:53:02 2016 +0100
colorpicker: allow color name changes from colorpicker UI
After selecting a color name ('red' for example),
you can now change it from the color plane.
For now, we don't search for a matching existing color name,
but use the rgba syntax. see the TODO
contrib/gstyle/gstyle-color.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/contrib/gstyle/gstyle-color.c b/contrib/gstyle/gstyle-color.c
index bc35219..cdc8dd4 100644
--- a/contrib/gstyle/gstyle-color.c
+++ b/contrib/gstyle/gstyle-color.c
@@ -242,7 +242,14 @@ gstyle_color_to_string (GstyleColor *self,
string = g_strdup (predefined_colors_table [self->name_index].name);
else
{
- /* TODO: get similar color using cie2000 */
+ /* TODO: search for a corresponding name in the predefined_colors_table
+ * or fallback to rgba syntax
+ */
+ red = (guint)(0.5 + CLAMP (self->rgba.red, 0.0, 1.0) * 255.0);
+ green = (guint)(0.5 + CLAMP (self->rgba.green, 0.0, 1.0) * 255.0);
+ blue = (guint)(0.5 + CLAMP (self->rgba.blue, 0.0, 1.0) * 255.0);
+
+ string = g_strdup_printf ("rgba(%i, %i, %i, %s)", red, green, blue, alpha_str);
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]