diff options
author | Jörg Frings-Fürst <debian@jff.email> | 2018-10-01 07:17:16 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff.email> | 2018-10-01 07:17:16 +0200 |
commit | 71137cc5832110d91599d68790402cf196762ed3 (patch) | |
tree | e7985bbfb6ca50ea738b38a9f852ee51431d48a7 /src/config/Config.vala | |
parent | 8ae550d463720d5d1c0e253af29843ff15de1a54 (diff) | |
parent | 1e92964463e564bb3359a7110342182fcfdc67f2 (diff) |
Merge branch 'release/debian/0.30.1-1'debian/0.30.1-1
Diffstat (limited to 'src/config/Config.vala')
-rw-r--r-- | src/config/Config.vala | 93 |
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. |