summaryrefslogtreecommitdiff
path: root/src/config/Config.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-09-30 14:11:00 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-09-30 14:11:00 +0200
commit0ac947a9070322180e94d1b71e30836cce4d74bc (patch)
tree4a6f3923c250377536a5004ed203768111a1d27f /src/config/Config.vala
parenteca5837e235a356c8db9416bbbc13577db3e6f76 (diff)
parent01b2b5ec9177046f64c6d0a6e73a6ac8a42089a1 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'src/config/Config.vala')
-rw-r--r--src/config/Config.vala93
1 files changed, 1 insertions, 92 deletions
diff --git a/src/config/Config.vala b/src/config/Config.vala
index f80bfce..5675567 100644
--- a/src/config/Config.vala
+++ b/src/config/Config.vala
@@ -20,25 +20,9 @@ public class Facade : ConfigurationFacade {
public const int HEIGHT_DEFAULT = 768;
public const int SIDEBAR_MIN_POSITION = 180;
public const int SIDEBAR_MAX_POSITION = 1000;
- public const string DEFAULT_BG_COLOR = "#444";
public const int NO_VIDEO_INTERPRETER_STATE = -1;
- private const double BLACK_THRESHOLD = 0.61;
- private const string DARK_SELECTED_COLOR = "#0AD";
- private const string LIGHT_SELECTED_COLOR = "#2DF";
- private const string DARK_UNSELECTED_COLOR = "#000";
- private const string LIGHT_UNSELECTED_COLOR = "#FFF";
- private const string DARK_BORDER_COLOR = "#999";
- private const string LIGHT_BORDER_COLOR = "#AAA";
- private const string DARK_UNFOCUSED_SELECTED_COLOR = "#6fc4dd";
- private const string LIGHT_UNFOCUSED_SELECTED_COLOR = "#99efff";
-
- private string bg_color = null;
- private string selected_color = null;
- private string unselected_color = null;
- private string unfocused_selected_color = null;
- private string border_color = null;
-
+
private static Facade instance = null;
public signal void colors_changed();
@@ -46,7 +30,6 @@ public class Facade : ConfigurationFacade {
private Facade() {
base(new GSettingsConfigurationEngine());
- bg_color_name_changed.connect(on_color_name_changed);
transparent_background_type_changed.connect(on_color_name_changed);
transparent_background_color_changed.connect(on_color_name_changed);
}
@@ -61,80 +44,6 @@ public class Facade : ConfigurationFacade {
private void on_color_name_changed() {
colors_changed();
}
-
- private void set_text_colors(Gdk.RGBA bg_color) {
- // since bg color is greyscale, we only need to compare the red value to the threshold,
- // which determines whether the background is dark enough to need light text and selection
- // colors or vice versa
- if (bg_color.red > BLACK_THRESHOLD) {
- selected_color = DARK_SELECTED_COLOR;
- unselected_color = DARK_UNSELECTED_COLOR;
- unfocused_selected_color = DARK_UNFOCUSED_SELECTED_COLOR;
- border_color = DARK_BORDER_COLOR;
- } else {
- selected_color = LIGHT_SELECTED_COLOR;
- unselected_color = LIGHT_UNSELECTED_COLOR;
- unfocused_selected_color = LIGHT_UNFOCUSED_SELECTED_COLOR;
- border_color = LIGHT_BORDER_COLOR;
- }
- }
-
- private void get_colors() {
- bg_color = base.get_bg_color_name();
-
- if (!is_color_parsable(bg_color))
- bg_color = DEFAULT_BG_COLOR;
-
- set_text_colors(parse_color(bg_color));
- }
-
- public Gdk.RGBA get_bg_color() {
- if (is_string_empty(bg_color))
- get_colors();
-
- return parse_color(bg_color);
- }
-
- public Gdk.RGBA get_selected_color(bool in_focus = true) {
- if (in_focus) {
- if (is_string_empty(selected_color))
- get_colors();
-
- return parse_color(selected_color);
- } else {
- if (is_string_empty(unfocused_selected_color))
- get_colors();
-
- return parse_color(unfocused_selected_color);
- }
- }
-
- public Gdk.RGBA get_unselected_color() {
- if (is_string_empty(unselected_color))
- get_colors();
-
- return parse_color(unselected_color);
- }
-
- public Gdk.RGBA get_border_color() {
- if (is_string_empty(border_color))
- get_colors();
-
- return parse_color(border_color);
- }
-
- public void set_bg_color(Gdk.RGBA color) {
- uint8 col_tmp = (uint8) (color.red * 255.0);
-
- bg_color = "#%02X%02X%02X".printf(col_tmp, col_tmp, col_tmp);
- set_bg_color_name(bg_color);
-
- set_text_colors(color);
- }
-
- public void commit_bg_color() {
- base.set_bg_color_name(bg_color);
- }
}
// preconfigure may be deleted if not used.