[gtksourceview] stylescheme: color helper for background/current-line-number



commit 0026f6636465122c02b98024d2857c7af7211479
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jul 20 15:45:45 2021 -0700

    stylescheme: color helper for background/current-line-number

 gtksourceview/gtksourcestylescheme-private.h |  6 ++++++
 gtksourceview/gtksourcestylescheme.c         | 29 ++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
---
diff --git a/gtksourceview/gtksourcestylescheme-private.h b/gtksourceview/gtksourcestylescheme-private.h
index 6f53ffd4..f45b6d2c 100644
--- a/gtksourceview/gtksourcestylescheme-private.h
+++ b/gtksourceview/gtksourcestylescheme-private.h
@@ -50,7 +50,13 @@ G_GNUC_INTERNAL
 gboolean              _gtk_source_style_scheme_get_current_line_color       (GtkSourceStyleScheme *scheme,
                                                                              GdkRGBA              *color);
 G_GNUC_INTERNAL
+gboolean              _gtk_source_style_scheme_get_current_line_number_color(GtkSourceStyleScheme *scheme,
+                                                                             GdkRGBA              *color);
+G_GNUC_INTERNAL
 gboolean              _gtk_source_style_scheme_get_background_pattern_color (GtkSourceStyleScheme *scheme,
                                                                              GdkRGBA              *color);
+G_GNUC_INTERNAL
+gboolean              _gtk_source_style_scheme_get_background_color         (GtkSourceStyleScheme *scheme,
+                                                                             GdkRGBA              *color);
 
 G_END_DECLS
diff --git a/gtksourceview/gtksourcestylescheme.c b/gtksourceview/gtksourcestylescheme.c
index 3e0d73bc..31545765 100644
--- a/gtksourceview/gtksourcestylescheme.c
+++ b/gtksourceview/gtksourcestylescheme.c
@@ -63,6 +63,7 @@
 #define STYLE_RIGHT_MARGIN             "right-margin"
 #define STYLE_DRAW_SPACES              "draw-spaces"
 #define STYLE_SNIPPET_FOCUS            "snippet-focus"
+#define STYLE_BACKGROUND               "background"
 #define STYLE_BACKGROUND_PATTERN       "background-pattern"
 
 #define STYLE_SCHEME_VERSION           "1.0"
@@ -679,6 +680,20 @@ _gtk_source_style_scheme_get_current_line_color (GtkSourceStyleScheme *scheme,
        return get_color (style, FALSE, color);
 }
 
+gboolean
+_gtk_source_style_scheme_get_current_line_number_color (GtkSourceStyleScheme *scheme,
+                                                        GdkRGBA              *color)
+{
+       GtkSourceStyle *style;
+
+       g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME (scheme), FALSE);
+       g_return_val_if_fail (color != NULL, FALSE);
+
+       style = gtk_source_style_scheme_get_style (scheme, STYLE_CURRENT_LINE_NUMBER);
+
+       return get_color (style, FALSE, color);
+}
+
 /*
  * Returns TRUE if the style for background-pattern-color is set in the scheme
  */
@@ -696,6 +711,20 @@ _gtk_source_style_scheme_get_background_pattern_color (GtkSourceStyleScheme *sch
        return get_color (style, FALSE, color);
 }
 
+gboolean
+_gtk_source_style_scheme_get_background_color (GtkSourceStyleScheme *scheme,
+                                               GdkRGBA              *color)
+{
+       GtkSourceStyle *style;
+
+       g_return_val_if_fail (GTK_SOURCE_IS_STYLE_SCHEME (scheme), FALSE);
+       g_return_val_if_fail (color != NULL, FALSE);
+
+       style = gtk_source_style_scheme_get_style (scheme, STYLE_BACKGROUND);
+
+       return get_color (style, FALSE, color);
+}
+
 static void
 apply_css_style_cursors (GtkSourceStyleScheme *scheme,
                          GString              *css)


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