Skip to content

Commit

Permalink
FrmSlideshow, FrmExportFrames: sync dark/light theme with OS
Browse files Browse the repository at this point in the history
  • Loading branch information
d2phap committed Feb 24, 2023
1 parent 4fedc09 commit 32981ed
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
6 changes: 6 additions & 0 deletions v9/Components/ImageGlass.Settings/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,12 @@ public static void LoadThemePack(bool darkMode, bool useFallBackTheme, bool thro
themeFolderName = Constants.DEFAULT_THEME;
}

// theme pack is already updated
if (themeFolderName.Equals(Theme.FolderName, StringComparison.InvariantCultureIgnoreCase))
{
return;
}

var th = new IgTheme(App.ConfigDir(PathType.Dir, Dir.Themes, themeFolderName));

if (!th.IsValid)
Expand Down
12 changes: 6 additions & 6 deletions v9/Utilities/igcmd/FrmExportFrames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ protected override void ApplyTheme(bool darkMode, BackdropStyle? style = null)
}


//protected override void OnRequestUpdatingColorMode(SystemColorModeChangedEventArgs e)
//{
// // update theme here
// ApplyTheme(e.IsDarkMode);
protected override void OnRequestUpdatingColorMode(SystemColorModeChangedEventArgs e)
{
// theme mode is changed, need to load the corresponding theme pack
Config.LoadThemePack(e.IsDarkMode, true, true);

// base.OnRequestUpdatingColorMode(e);
//}
base.OnRequestUpdatingColorMode(e);
}


protected override int OnUpdateHeight(bool performUpdate = true)
Expand Down
18 changes: 12 additions & 6 deletions v9/Utilities/igcmd/Slideshow/FrmSlideshow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,19 @@ protected override void OnSystemAccentColorChanged(SystemAccentColorChangedEvent
}


//protected override void OnRequestUpdatingColorMode(SystemColorModeChangedEventArgs e)
//{
// // update theme here
// ApplyTheme(e.IsDarkMode);
protected override void OnRequestUpdatingColorMode(SystemColorModeChangedEventArgs e)
{
// theme mode is changed, need to load the corresponding theme pack
Config.LoadThemePack(e.IsDarkMode, true, true);

// load the theme icons
OnDpiChanged();

// base.OnRequestUpdatingColorMode(e);
//}
// apply theme to controls
ApplyTheme(Config.Theme.Settings.IsDarkMode);

base.OnRequestUpdatingColorMode(e);
}


protected override void OnDpiChanged()
Expand Down

0 comments on commit 32981ed

Please sign in to comment.