Skip to content

Commit

Permalink
let's fix dark mode strength
Browse files Browse the repository at this point in the history
  • Loading branch information
lainsce authored Jan 8, 2023
1 parent b607e0f commit b2af81d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/Models/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ public class He.Application : Gtk.Application {
He.Color.RGBColor derived_bg;
He.Color.RGBColor derived_card_fg;
He.Color.RGBColor derived_card_bg;
if (desktop.dark_mode_strength == Desktop.DarkModeStrength.MEDIUM) {
if (Desktop.DarkModeStrength.MEDIUM == desktop.dark_mode_strength) {
derived_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.WHITE : He.Color.BLACK;
derived_bg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.BLACK : He.Color.WHITE;
derived_card_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.CARD_BLACK : He.Color.CARD_WHITE;
derived_card_bg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.CARD_BLACK : He.Color.CARD_WHITE;
} else if (desktop.dark_mode_strength == Desktop.DarkModeStrength.SOFT) {
} else if (Desktop.DarkModeStrength.SOFT == desktop.dark_mode_strength) {
derived_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.WHITE : He.Color.SOFT_BLACK;
derived_bg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.SOFT_BLACK : He.Color.WHITE;
derived_card_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.SOFT_CARD_BLACK : He.Color.CARD_WHITE;
derived_card_bg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.SOFT_CARD_BLACK : He.Color.CARD_WHITE;
} else if (desktop.dark_mode_strength == Desktop.DarkModeStrength.HARSH) {
} else if (Desktop.DarkModeStrength.HARSH == desktop.dark_mode_strength) {
derived_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.WHITE : He.Color.HARSH_BLACK;
derived_bg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.HARSH_BLACK : He.Color.WHITE;
derived_card_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.HARSH_CARD_BLACK : He.Color.CARD_WHITE;
Expand All @@ -142,11 +142,11 @@ public class He.Application : Gtk.Application {
He.Color.RGBColor derived_accent_fg;
var derived_accent_as_fg = He.Color.derive_contasting_color(lch_color, fg_contrast, null);
var derived_bg_c = He.Color.derive_contasting_color(lch_color, bg_contrast, null);
if (desktop.dark_mode_strength == Desktop.DarkModeStrength.MEDIUM) {
if (Desktop.DarkModeStrength.MEDIUM == desktop.dark_mode_strength) {
derived_accent_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.BLACK : He.Color.WHITE;
} else if (desktop.dark_mode_strength == Desktop.DarkModeStrength.SOFT) {
} else if (Desktop.DarkModeStrength.SOFT == desktop.dark_mode_strength) {
derived_accent_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.SOFT_BLACK : He.Color.WHITE;
} else if (desktop.dark_mode_strength == Desktop.DarkModeStrength.HARSH) {
} else if (Desktop.DarkModeStrength.HARSH == desktop.dark_mode_strength) {
derived_accent_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.HARSH_BLACK : He.Color.WHITE;
} else {
derived_accent_fg = Desktop.ColorScheme.DARK == desktop.prefers_color_scheme ? He.Color.BLACK : He.Color.WHITE;
Expand Down Expand Up @@ -203,6 +203,10 @@ public class He.Application : Gtk.Application {

desktop.notify["prefers-color-scheme"].connect (() => {
update_accent_color();

desktop.notify["dark-mode-strength"].connect (() => {
update_accent_color();
});

style_provider_set_enabled (light, desktop.prefers_color_scheme != He.Desktop.ColorScheme.DARK, STYLE_PROVIDER_PRIORITY_PLATFORM);
style_provider_set_enabled (dark, desktop.prefers_color_scheme == He.Desktop.ColorScheme.DARK, STYLE_PROVIDER_PRIORITY_PLATFORM);
Expand Down

0 comments on commit b2af81d

Please sign in to comment.