[gnome-builder] add dark style



commit 7b97b5ad010f37ae636949539b859674692ec910
Author: Christian Hergert <christian hergert me>
Date:   Wed Dec 17 23:14:43 2014 -0800

    add dark style

 data/data.mk                 |    2 +-
 data/styles/builder-dark.xml |  129 ++++++++++++++++++++++++++++++++++++++++++
 src/editor/gb-source-view.c  |   18 ++++--
 3 files changed, 143 insertions(+), 6 deletions(-)
---
diff --git a/data/data.mk b/data/data.mk
index e5bcad7..eb3f67f 100644
--- a/data/data.mk
+++ b/data/data.mk
@@ -13,7 +13,7 @@ CLEANFILES += $(service_DATA)
 
 # GtkSourceView Style Scheme
 styledir = $(datadir)/gtksourceview-3.0/styles/
-style_DATA = data/styles/builder.xml
+style_DATA = data/styles/builder.xml data/styles/builder-dark.xml
 EXTRA_DIST += $(style_DATA)
 
 data/org.gnome.Builder.service: data/org.gnome.Builder.service.in
diff --git a/data/styles/builder-dark.xml b/data/styles/builder-dark.xml
new file mode 100644
index 0000000..faf15c2
--- /dev/null
+++ b/data/styles/builder-dark.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ This file is part of GtkSourceView
+
+ Copyright (C) 2007 GtkSourceView team
+ Author: Paolo Borelli <pborelli gnome org>
+
+ GtkSourceView is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ GtkSourceView is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+-->
+
+<style-scheme id="builder-dark" _name="Builder Dark" version="1.0">
+
+  <author>Paolo Borelli, Christian Hergert</author>
+  <_description>Dark color scheme for Builder using the Tango color palette</_description>
+
+  <!-- Tango Palette -->
+  <color name="butter1"                     value="#fce94f"/>
+  <color name="butter2"                     value="#edd400"/>
+  <color name="butter3"                     value="#c4a000"/>
+  <color name="chameleon1"                  value="#8ae234"/>
+  <color name="chameleon2"                  value="#73d216"/>
+  <color name="chameleon3"                  value="#4e9a06"/>
+  <color name="orange1"                     value="#fcaf3e"/>
+  <color name="orange2"                     value="#f57900"/>
+  <color name="orange3"                     value="#ce5c00"/>
+  <color name="skyblue1"                    value="#729fcf"/>
+  <color name="skyblue2"                    value="#3465a4"/>
+  <color name="skyblue3"                    value="#204a87"/>
+  <color name="plum1"                       value="#ad7fa8"/>
+  <color name="plum2"                       value="#75507b"/>
+  <color name="plum3"                       value="#5c3566"/>
+  <color name="chocolate1"                  value="#e9b96e"/>
+  <color name="chocolate2"                  value="#c17d11"/>
+  <color name="chocolate3"                  value="#8f5902"/>
+  <color name="scarletred1"                 value="#ef2929"/>
+  <color name="scarletred2"                 value="#cc0000"/>
+  <color name="scarletred3"                 value="#a40000"/>
+  <color name="aluminium1"                  value="#eeeeec"/>
+  <color name="aluminium2"                  value="#d3d7cf"/>
+  <color name="aluminium3"                  value="#babdb6"/>
+  <color name="aluminium4"                  value="#888a85"/>
+  <color name="aluminium5"                  value="#555753"/>
+  <color name="aluminium6"                  value="#2e3436"/>
+  <color name="white"                       value="#ffffff"/>
+
+  <!-- Global Settings -->
+  <style name="text"                        foreground="aluminium3" background="aluminium6"/>
+  <style name="selection"                   foreground="aluminium1" background="aluminium4"/>
+  <style name="cursor"                      foreground="aluminium2"/>
+  <style name="current-line"                background="#rgba(85,87,83,.5)"/>
+  <style name="line-numbers"                foreground="aluminium4" background="aluminium6"/>
+  <style name="draw-spaces"                 foreground="aluminium4"/>
+
+  <!-- Bracket Matching -->
+  <style name="bracket-match"               foreground="chocolate2" bold="true"/>
+  <style name="bracket-mismatch"            foreground="aluminium1" background="scarletred2" bold="true"/>
+
+  <!-- Right Margin -->
+  <style name="right-margin"                foreground="aluminium3" background="aluminium6"/>
+
+  <!-- Search Matching -->
+  <style name="search-match"                foreground="aluminium1" background="chameleon3"/>
+
+  <!-- Comments -->
+  <style name="def:comment"                 foreground="aluminium4"/>
+  <style name="def:shebang"                 foreground="aluminium4" bold="true"/>
+  <style name="def:doc-comment-element"     italic="true"/>
+
+  <!-- Constants -->
+  <style name="def:constant"                foreground="butter2"/>
+  <style name="def:string"                  foreground="#0077aa"/>
+  <style name="def:special-char"            foreground="#dd4a68"/>
+  <style name="def:special-constant"        foreground="plum1"/>
+  <style name="def:floating-point"          foreground="orange3"/>
+
+  <!-- Identifiers -->
+  <style name="def:identifier"              foreground="skyblue1"/>
+
+  <!-- Statements -->
+  <style name="def:statement"               foreground="white" bold="true"/>
+
+  <!-- Types -->
+  <style name="def:type"                    foreground="chameleon1" bold="true"/>
+
+  <!-- Others -->
+  <style name="def:preprocessor"            foreground="#dd4a68"/>
+  <style name="def:error"                   foreground="aluminium1" background="scarletred2" bold="true"/>
+  <style name="def:warning"                 foreground="aluminium1" background="plum1"/>
+  <style name="def:note"                    background="butter1" foreground="aluminium4" bold="true"/>
+  <style name="def:underlined"              italic="true" underline="true"/>
+
+  <!-- Heading styles, uncomment to enable -->
+  <!--
+  <style name="def:heading0"                scale="5.0"/>
+  <style name="def:heading1"                scale="2.5"/>
+  <style name="def:heading2"                scale="2.0"/>
+  <style name="def:heading3"                scale="1.7"/>
+  <style name="def:heading4"                scale="1.5"/>
+  <style name="def:heading5"                scale="1.3"/>
+  <style name="def:heading6"                scale="1.2"/>
+  -->
+
+  <!-- Language specific -->
+  <style name="diff:added-line"             foreground="butter2"/>
+  <style name="diff:removed-line"           foreground="skyblue1"/>
+  <style name="diff:changed-line"           foreground="plum1"/>
+  <style name="diff:diff-file"              foreground="chameleon1" bold="true"/>
+  <style name="diff:location"               foreground="chameleon1"/>
+  <style name="diff:special-case"           foreground="white" bold="true"/>
+
+  <style name="latex:command"               foreground="chameleon1" bold="true"/>
+  <style name="latex:include"               use-style="def:preprocessor"/>
+
+</style-scheme>
+
diff --git a/src/editor/gb-source-view.c b/src/editor/gb-source-view.c
index 726859e..986ebdf 100644
--- a/src/editor/gb-source-view.c
+++ b/src/editor/gb-source-view.c
@@ -1574,10 +1574,12 @@ gb_source_view_real_draw_layer (GbSourceView     *view,
                                 GtkTextViewLayer  layer,
                                 cairo_t          *cr)
 {
-  static GdkRGBA lines = { 0 };
+  static GdkRGBA lines_dark = { 0 };
+  static GdkRGBA lines_light = { 0 };
   GbSourceViewPrivate *priv = view->priv;
   GtkSourceStyleScheme *scheme;
   GtkTextView *text_view = GTK_TEXT_VIEW (view);
+  const gchar *scheme_id;
   GtkTextBuffer *buffer;
 
   /*
@@ -1591,10 +1593,12 @@ gb_source_view_real_draw_layer (GbSourceView     *view,
       (buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))) &&
       GTK_SOURCE_IS_BUFFER (buffer) &&
       (scheme = gtk_source_buffer_get_style_scheme (GTK_SOURCE_BUFFER (buffer))) &&
-      g_strcmp0 ("builder", gtk_source_style_scheme_get_id (scheme)) == 0)
+      (scheme_id = gtk_source_style_scheme_get_id (scheme)) &&
+      strncmp ("builder", scheme_id, 7) == 0)
     {
       GdkRectangle clip;
       GdkRectangle vis;
+      GdkRGBA *lines;
       gdouble x;
       gdouble y;
       PangoContext *context;
@@ -1611,12 +1615,16 @@ gb_source_view_real_draw_layer (GbSourceView     *view,
       /* each character becomes 2 stacked boxes. */
       grid_height /= 2;
 
-      if (lines.alpha == 0.0)
-        gdk_rgba_parse (&lines, "rgba(.125,.125,.125,.025)");
+      if (lines_light.alpha == 0.0)
+        gdk_rgba_parse (&lines_light, "rgba(.125,.125,.125,.025)");
+      if (lines_dark.alpha == 0.0)
+        gdk_rgba_parse (&lines_dark, "#32383a");
+
+      lines = g_str_equal ("builder", scheme_id) ? &lines_light : &lines_dark;
 
       cairo_save (cr);
       cairo_set_line_width (cr, 1.0);
-      gdk_cairo_set_source_rgba (cr, &lines);
+      gdk_cairo_set_source_rgba (cr, lines);
       gdk_cairo_get_clip_rectangle (cr, &clip);
       gtk_text_view_get_visible_rect (text_view, &vis);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]