The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Use theme colors in overview

These changes was commited to the Birdfont repository Tue, 17 Mar 2015 12:14:22 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 17 Mar 2015 12:14:22 +0000 (13:14 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Tue, 17 Mar 2015 12:14:22 +0000 (13:14 +0100)
commit f1581db629d01eae7aa02a9a50f4113cf0a04fb1
tree b6444d119122ed32598386442ea7e94e6f71e01b
parent 7dbf1f917c164a486e16fd148007aa5e9e80ee38
Use theme colors in overview

libbirdfont/CharacterInfo.vala
libbirdfont/OverViewItem.vala
libbirdfont/TabContent.vala
libbirdfont/Theme.vala
resources/default.theme
resources/high_contrast.theme
--- a/libbirdfont/CharacterInfo.vala +++ b/libbirdfont/CharacterInfo.vala @@ -36,7 +36,6 @@ name = ((!) gc).get_name (); icon.load_font ("icons.bf"); icon.use_cache (false); - Theme.text_color (icon, "Foreground 1"); } } @@ -61,10 +60,16 @@ return (x <= px <= x + 12) && (y <= py <= y + 24); } - public void draw_icon (Context cr) { + public void draw_icon (Context cr, bool selected) { + if (selected) { + Theme.text_color (icon, "Overview Selected Foreground"); + } else { + Theme.text_color (icon, "Overview Foreground"); + } + icon.draw_at_top (cr, x, y); } } }
--- a/libbirdfont/OverViewItem.vala +++ b/libbirdfont/OverViewItem.vala @@ -226,11 +226,9 @@ p = new Cairo.Pattern.linear (0.0, y + height - 20, 0.0, y + height); if (selected) { - p.add_color_stop_rgba (1, 208 / 255.0, 208 / 255.0, 208 / 255.0, 1); - p.add_color_stop_rgba (0, 229 / 255.0, 229 / 255.0, 229 / 255.0, 1); + Theme.gradient (p, "Selected Overview Item 1", "Selected Overview Item 2"); } else { - p.add_color_stop_rgba (1, 236 / 255.0, 236 / 255.0, 236 / 255.0, 1); - p.add_color_stop_rgba (0, 246 / 255.0, 246 / 255.0, 246 / 255.0, 1); + Theme.gradient (p, "Overview Item 1", "Overview Item 2"); } cr.rectangle (x + 1, y + height - 20, width - 2, 20 - 1); @@ -250,7 +248,12 @@ label = new Text (text, 17); label.truncate (w); label.use_cache (true); - Theme.text_color (label, "Foreground 6"); + + if (selected) { + Theme.text_color (label, "Overview Selected Foreground"); + } else { + Theme.text_color (label, "Overview Foreground"); + } label.draw_at_baseline (cr, x + 0.08 * width, y + height - 6); } @@ -259,7 +262,7 @@ double px = x + width - 17; double py = y + height - 21; info.set_position (px, py); - info.draw_icon (cr); + info.draw_icon (cr, selected); } private void draw_menu (Context cr) { @@ -274,7 +277,13 @@ icon = new Text ("dropdown_menu", 17); icon.load_font ("icons.bf"); icon.use_cache (true); - Theme.text_color (icon, "Foreground 6"); + + if (selected) { + Theme.text_color (icon, "Overview Selected Foreground"); + } else { + Theme.text_color (icon, "Overview Foreground"); + } + icon.draw_at_top (cr, x + width - 32, y + height - 19); g = (!) glyphs;
--- a/libbirdfont/TabContent.vala +++ b/libbirdfont/TabContent.vala @@ -295,7 +295,7 @@ cr.fill (); cr.restore (); - Theme.text_color (text_input_label, "Foreground Inverted"); + Theme.text_color (text_input_label, "Button Foreground"); text_input_label.widget_x = 10; text_input_label.widget_y = 17;
--- a/libbirdfont/Theme.vala +++ b/libbirdfont/Theme.vala @@ -58,6 +58,14 @@ c = colors.get (name); cr.set_source_rgba (c.r, c.g, c.b, opacity); + } + + public static void gradient (Cairo.Pattern p, string name1, string name2) { + Color c1 = get_color (name1); + Color c2 = get_color (name2); + + p.add_color_stop_rgba (1, c1.r, c1.g, c1.b, c1.a); + p.add_color_stop_rgba (0, c2.r, c2.g, c2.b, c2.a); } public static void text_color_opacity (Text text, string name, double opacity) { @@ -82,7 +90,7 @@ return colors.get (name); } - + public static void set_default_colors () { current_theme = "default.theme"; color_list = new Gee.ArrayList<string> (); @@ -149,7 +157,17 @@ Theme.set_default_color ("Selected Tool Foreground", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1); Theme.set_default_color ("Text Area Background", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1); - + + Theme.set_default_color ("Selected Overview Item 1", 208 / 255.0, 208 / 255.0, 208 / 255.0, 1); + Theme.set_default_color ("Selected Overview Item 2", 229 / 255.0, 229 / 255.0, 229 / 255.0, 1); + + Theme.set_default_color ("Overview Item 1", 236 / 255.0, 236 / 255.0, 236 / 255.0, 1); + Theme.set_default_color ("Overview Item 2", 246 / 255.0, 246 / 255.0, 246 / 255.0, 1); + + Theme.set_default_color ("Overview Selected Foreground", 45 / 255.0, 45 / 255.0, 45 / 255.0, 1); + Theme.set_default_color ("Overview Foreground", 45 / 255.0, 45 / 255.0, 45 / 255.0, 1); + + if (BirdFont.has_argument ("--test")) { current_theme = "generated_theme.theme"; write_theme (); @@ -203,6 +221,15 @@ t_("Selected Tool Foreground"); t_("Text Area Background"); + + t_("Selected Overview Item 1"); + t_("Selected Overview Item 2"); + + t_("Overview Item 1"); + t_("Overview Item 2"); + + t_("Overview Selected Foreground"); + t_("Overview Foreground"); } }
--- a/resources/default.theme +++ b/resources/default.theme @@ -8,7 +8,9 @@ <color name="Foreground 7" red="0.85882352941176465" green="0.8666666666666667" blue="0.9137254901960784" alpha="1"/> <color name="Background 2" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="1"/> <color name="Guide 3" red="0.47058823529411764" green="0.26666666666666666" blue="0.47058823529411764" alpha="0.47058823529411764"/> + <color name="Selected Overview Item 1" red="0.81568627450980391" green="0.81568627450980391" blue="0.81568627450980391" alpha="1"/> <color name="Background 3" red="0.14901960784313725" green="0.15294117647058825" blue="0.16862745098039217" alpha="1"/> + <color name="Selected Overview Item 2" red="0.89803921568627454" green="0.89803921568627454" blue="0.89803921568627454" alpha="1"/> <color name="Background 4" red="0.20000000000000001" green="0.21176470588235294" blue="0.23137254901960785" alpha="1"/> <color name="Background 5" red="0.29999999999999999" green="0.29999999999999999" blue="0.29999999999999999" alpha="1"/> <color name="Background 6" red="0.8784313725490196" green="0.8784313725490196" blue="0.8784313725490196" alpha="1"/> @@ -33,14 +35,18 @@ <color name="Handle Color" red="0" green="0" blue="0" alpha="1"/> <color name="Button Border 4" red="0.14901960784313725" green="0.15294117647058825" blue="0.16862745098039217" alpha="1"/> <color name="Highlighted Guide" red="0" green="0" blue="0.29999999999999999" alpha="1"/> + <color name="Overview Item 1" red="0.92549019607843142" green="0.92549019607843142" blue="0.92549019607843142" alpha="1"/> + <color name="Overview Item 2" red="0.96470588235294119" green="0.96470588235294119" blue="0.96470588235294119" alpha="1"/> <color name="Selected Button Foreground" red="1" green="1" blue="1" alpha="1"/> <color name="Menu Foreground" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="1"/> + <color name="Overview Foreground" red="0.17647058823529413" green="0.17647058823529413" blue="0.17647058823529413" alpha="1"/> <color name="Tool Foreground" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="1"/> <color name="Foreground 1" red="0" green="0" blue="0" alpha="1"/> <color name="Foreground 2" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="1"/> <color name="Foreground 3" red="0.10196078431372549" green="0.11764705882352941" blue="0.12549019607843137" alpha="1"/> + <color name="Overview Selected Foreground" red="0.17647058823529413" green="0.17647058823529413" blue="0.17647058823529413" alpha="1"/> <color name="Foreground 4" red="0.15686274509803921" green="0.22352941176470589" blue="0.25490196078431371" alpha="1"/> <color name="Foreground Inverted" red="1" green="1" blue="1" alpha="1"/> <color name="Foreground 5" red="0.27450980392156865" green="0.30196078431372547" blue="0.32549019607843138" alpha="1"/> </theme>
--- a/resources/high_contrast.theme +++ b/resources/high_contrast.theme @@ -5,10 +5,12 @@ <color name="Foreground 6" red="0" green="0" blue="0" alpha="1"/> <color name="Background 1" red="1" green="1" blue="1" alpha="1"/> <color name="Guide 2" red="0" green="0" blue="0" alpha="1"/> - <color name="Foreground 7" red="1" green="1" blue="1" alpha="1"/> + <color name="Foreground 7" red="0" green="0" blue="0" alpha="1"/> <color name="Background 2" red="0" green="0" blue="0" alpha="1"/> <color name="Guide 3" red="0" green="0" blue="0" alpha="1"/> + <color name="Selected Overview Item 1" red="0" green="0" blue="0" alpha="1"/> <color name="Background 3" red="0" green="0" blue="0" alpha="1"/> + <color name="Selected Overview Item 2" red="0" green="0" blue="0" alpha="1"/> <color name="Background 4" red="1" green="1" blue="1" alpha="1"/> <color name="Background 5" red="1" green="1" blue="1" alpha="1"/> <color name="Background 6" red="1" green="1" blue="1" alpha="1"/> @@ -33,14 +35,18 @@ <color name="Handle Color" red="0" green="0" blue="0" alpha="1"/> <color name="Button Border 4" red="0" green="0" blue="0" alpha="1"/> <color name="Highlighted Guide" red="0" green="0" blue="0" alpha="1"/> + <color name="Overview Item 1" red="1" green="1" blue="1" alpha="1"/> + <color name="Overview Item 2" red="1" green="1" blue="1" alpha="1"/> <color name="Selected Button Foreground" red="1" green="1" blue="1" alpha="1"/> <color name="Menu Foreground" red="1" green="1" blue="1" alpha="1"/> + <color name="Overview Foreground" red="0" green="0" blue="0" alpha="1"/> <color name="Tool Foreground" red="0" green="0" blue="0" alpha="1"/> <color name="Foreground 1" red="0" green="0" blue="0" alpha="1"/> <color name="Foreground 2" red="0" green="0" blue="0" alpha="1"/> <color name="Foreground 3" red="0" green="0" blue="0" alpha="1"/> + <color name="Overview Selected Foreground" red="1" green="1" blue="1" alpha="1"/> <color name="Foreground 4" red="1" green="1" blue="1" alpha="1"/> <color name="Foreground Inverted" red="1" green="1" blue="1" alpha="1"/> <color name="Foreground 5" red="0" green="0" blue="0" alpha="1"/> </theme>