From c61bc946e86a3a826c600e36ef2a285bdf252314 Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Wed, 1 May 2024 02:35:11 +0300 Subject: [PATCH 1/6] Delete manifest --- LightBulb/LightBulb.csproj | 1 - LightBulb/app.manifest | 9 --------- 2 files changed, 10 deletions(-) delete mode 100644 LightBulb/app.manifest diff --git a/LightBulb/LightBulb.csproj b/LightBulb/LightBulb.csproj index d3ab0cd2..4c826f6c 100644 --- a/LightBulb/LightBulb.csproj +++ b/LightBulb/LightBulb.csproj @@ -3,7 +3,6 @@ WinExe true - app.manifest ..\favicon.ico diff --git a/LightBulb/app.manifest b/LightBulb/app.manifest deleted file mode 100644 index 42a047e7..00000000 --- a/LightBulb/app.manifest +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file From 9e8b788799d7d1ffe82e6721f9888c2d09f65e89 Mon Sep 17 00:00:00 2001 From: LilithSilver <84940819+LilithSilver@users.noreply.github.com> Date: Mon, 6 May 2024 14:47:50 -0700 Subject: [PATCH 2/6] Force Light Mode permanently on (#297) --- LightBulb/App.axaml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/LightBulb/App.axaml b/LightBulb/App.axaml index bcb2afd9..80eb4467 100644 --- a/LightBulb/App.axaml +++ b/LightBulb/App.axaml @@ -6,13 +6,22 @@ xmlns:framework="clr-namespace:LightBulb.Framework" xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles" xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" - xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"> + xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles" + RequestedThemeVariant="Light"> - - + + + From 548548cbc8407ddd6bcbf411fb21055ea73c9aaa Mon Sep 17 00:00:00 2001 From: LilithSilver <84940819+LilithSilver@users.noreply.github.com> Date: Mon, 6 May 2024 15:02:23 -0700 Subject: [PATCH 3/6] Add customizable max transition duration for settings changes (#291) --- LightBulb.PlatformInterop/Timer.cs | 2 + LightBulb/Services/SettingsService.cs | 3 + .../Components/DashboardViewModel.cs | 58 ++++++++++++++++++- 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/LightBulb.PlatformInterop/Timer.cs b/LightBulb.PlatformInterop/Timer.cs index 096a71f9..34a25a2e 100644 --- a/LightBulb.PlatformInterop/Timer.cs +++ b/LightBulb.PlatformInterop/Timer.cs @@ -33,6 +33,8 @@ public Timer(TimeSpan firstTickDelay, TimeSpan interval, Action tick) public Timer(TimeSpan interval, Action callback) : this(TimeSpan.Zero, interval, callback) { } + public TimeSpan Interval => _interval; + private void Tick() { // Prevent multiple reentry diff --git a/LightBulb/Services/SettingsService.cs b/LightBulb/Services/SettingsService.cs index 33e40d99..fb197c6b 100644 --- a/LightBulb/Services/SettingsService.cs +++ b/LightBulb/Services/SettingsService.cs @@ -63,6 +63,9 @@ public partial class SettingsService() : SettingsBase(GetFilePath()) [ObservableProperty] private double _configurationTransitionOffset; + [ObservableProperty] + private TimeSpan _configurationSmoothingMaxDuration = TimeSpan.FromSeconds(15); + // Location [ObservableProperty] diff --git a/LightBulb/ViewModels/Components/DashboardViewModel.cs b/LightBulb/ViewModels/Components/DashboardViewModel.cs index 89404024..0c023f12 100644 --- a/LightBulb/ViewModels/Components/DashboardViewModel.cs +++ b/LightBulb/ViewModels/Components/DashboardViewModel.cs @@ -285,12 +285,66 @@ private void UpdateInstant() } } + private const double _brightnessDefaultStep = 0.08; + private const double _temperatureDefaultStep = 30; + + private ColorConfiguration _lastTarget; + private void UpdateConfiguration() { - var isSmooth = _settingsService.IsConfigurationSmoothingEnabled && !IsCyclePreviewEnabled; + if (CurrentConfiguration == TargetConfiguration) + { + _gammaService.SetGamma(CurrentConfiguration); + return; + } + + double stepsPerSecond = 1000 / _updateConfigurationTimer.Interval.TotalMilliseconds; + + var isSmooth = + _settingsService.IsConfigurationSmoothingEnabled + && !IsCyclePreviewEnabled + && _settingsService.ConfigurationSmoothingMaxDuration.TotalSeconds >= 0.1; + + // If we've changed targets, restart with default settings. + if (_lastTarget != TargetConfiguration && isSmooth) + { + _lastTarget = TargetConfiguration; + } + + double brightnessMaxStep = _brightnessDefaultStep; + double temperatureMaxStep = _temperatureDefaultStep; + + // Calculate the step size... + var tempDelta = Math.Abs( + TargetConfiguration.Temperature - CurrentConfiguration.Temperature + ); + var brightnessDelta = Math.Abs( + TargetConfiguration.Brightness - CurrentConfiguration.Brightness + ); + var expectedTemperatureDuration = tempDelta / (temperatureMaxStep * stepsPerSecond); + var expectedBrightnessDuration = brightnessDelta / (brightnessMaxStep * stepsPerSecond); + + // If the expected durations are longer than our duration limit, we adjust the step amount to stay at the max duration. + var goalDuration = Math.Max(expectedTemperatureDuration, expectedBrightnessDuration); + goalDuration = Math.Min( + goalDuration, + _settingsService.ConfigurationSmoothingMaxDuration.TotalSeconds + ); + + // Calculate the step-rate needed to reach the goal. + brightnessMaxStep = brightnessDelta / (goalDuration * stepsPerSecond); + temperatureMaxStep = tempDelta / (goalDuration * stepsPerSecond); + + // If we ended up slower on either of the durations, speed us up. + brightnessMaxStep = Math.Max(brightnessMaxStep, _brightnessDefaultStep); + temperatureMaxStep = Math.Max(temperatureMaxStep, _temperatureDefaultStep); CurrentConfiguration = isSmooth - ? CurrentConfiguration.StepTo(TargetConfiguration, 30, 0.008) + ? CurrentConfiguration.StepTo( + TargetConfiguration, + temperatureMaxStep, + brightnessMaxStep + ) : TargetConfiguration; _gammaService.SetGamma(CurrentConfiguration); From 0dd6505456739bea7a0ca6024c655756c3d4ac2c Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 7 May 2024 02:05:11 +0300 Subject: [PATCH 4/6] Refactor last PR --- LightBulb/Services/SettingsService.cs | 2 +- .../Components/DashboardViewModel.cs | 98 +++++++++---------- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/LightBulb/Services/SettingsService.cs b/LightBulb/Services/SettingsService.cs index fb197c6b..f33cce70 100644 --- a/LightBulb/Services/SettingsService.cs +++ b/LightBulb/Services/SettingsService.cs @@ -64,7 +64,7 @@ public partial class SettingsService() : SettingsBase(GetFilePath()) private double _configurationTransitionOffset; [ObservableProperty] - private TimeSpan _configurationSmoothingMaxDuration = TimeSpan.FromSeconds(15); + private TimeSpan _configurationSmoothingMaxDuration = TimeSpan.FromSeconds(5); // Location diff --git a/LightBulb/ViewModels/Components/DashboardViewModel.cs b/LightBulb/ViewModels/Components/DashboardViewModel.cs index 0c023f12..22f9f9fd 100644 --- a/LightBulb/ViewModels/Components/DashboardViewModel.cs +++ b/LightBulb/ViewModels/Components/DashboardViewModel.cs @@ -69,6 +69,9 @@ public partial class DashboardViewModel : ViewModelBase [ObservableProperty] private ColorConfiguration _currentConfiguration = ColorConfiguration.Default; + private ColorConfiguration? _configurationSmoothingSource; + private ColorConfiguration? _configurationSmoothingTarget; + public DashboardViewModel( SettingsService settingsService, GammaService gammaService, @@ -285,67 +288,62 @@ private void UpdateInstant() } } - private const double _brightnessDefaultStep = 0.08; - private const double _temperatureDefaultStep = 30; - - private ColorConfiguration _lastTarget; - private void UpdateConfiguration() { - if (CurrentConfiguration == TargetConfiguration) - { - _gammaService.SetGamma(CurrentConfiguration); - return; - } - - double stepsPerSecond = 1000 / _updateConfigurationTimer.Interval.TotalMilliseconds; - var isSmooth = - _settingsService.IsConfigurationSmoothingEnabled - && !IsCyclePreviewEnabled + !IsCyclePreviewEnabled + && CurrentConfiguration != TargetConfiguration + && _settingsService.IsConfigurationSmoothingEnabled && _settingsService.ConfigurationSmoothingMaxDuration.TotalSeconds >= 0.1; - // If we've changed targets, restart with default settings. - if (_lastTarget != TargetConfiguration && isSmooth) + if (isSmooth) { - _lastTarget = TargetConfiguration; - } - - double brightnessMaxStep = _brightnessDefaultStep; - double temperatureMaxStep = _temperatureDefaultStep; + // Check if the target configuration has changed since the last transition started + if ( + _configurationSmoothingTarget != TargetConfiguration + || _configurationSmoothingSource is null + ) + { + _configurationSmoothingSource = CurrentConfiguration; + _configurationSmoothingTarget = TargetConfiguration; + } + + var brightnessDelta = Math.Abs( + _configurationSmoothingTarget.Value.Brightness + - _configurationSmoothingSource.Value.Brightness + ); - // Calculate the step size... - var tempDelta = Math.Abs( - TargetConfiguration.Temperature - CurrentConfiguration.Temperature - ); - var brightnessDelta = Math.Abs( - TargetConfiguration.Brightness - CurrentConfiguration.Brightness - ); - var expectedTemperatureDuration = tempDelta / (temperatureMaxStep * stepsPerSecond); - var expectedBrightnessDuration = brightnessDelta / (brightnessMaxStep * stepsPerSecond); - - // If the expected durations are longer than our duration limit, we adjust the step amount to stay at the max duration. - var goalDuration = Math.Max(expectedTemperatureDuration, expectedBrightnessDuration); - goalDuration = Math.Min( - goalDuration, - _settingsService.ConfigurationSmoothingMaxDuration.TotalSeconds - ); + var brightnessStep = Math.Max( + brightnessDelta + / _settingsService.ConfigurationSmoothingMaxDuration.TotalSeconds + * _updateConfigurationTimer.Interval.TotalSeconds, + 0.08 + ); - // Calculate the step-rate needed to reach the goal. - brightnessMaxStep = brightnessDelta / (goalDuration * stepsPerSecond); - temperatureMaxStep = tempDelta / (goalDuration * stepsPerSecond); + var temperatureDelta = Math.Abs( + _configurationSmoothingTarget.Value.Temperature + - _configurationSmoothingSource.Value.Temperature + ); - // If we ended up slower on either of the durations, speed us up. - brightnessMaxStep = Math.Max(brightnessMaxStep, _brightnessDefaultStep); - temperatureMaxStep = Math.Max(temperatureMaxStep, _temperatureDefaultStep); + var temperatureStep = Math.Max( + temperatureDelta + / _settingsService.ConfigurationSmoothingMaxDuration.TotalSeconds + * _updateConfigurationTimer.Interval.TotalSeconds, + 30 + ); - CurrentConfiguration = isSmooth - ? CurrentConfiguration.StepTo( + CurrentConfiguration = CurrentConfiguration.StepTo( TargetConfiguration, - temperatureMaxStep, - brightnessMaxStep - ) - : TargetConfiguration; + temperatureStep, + brightnessStep + ); + } + else + { + CurrentConfiguration = TargetConfiguration; + _configurationSmoothingSource = null; + _configurationSmoothingTarget = null; + } _gammaService.SetGamma(CurrentConfiguration); } From bf98eb1c47f847962fa40d7a51d6015fad47156a Mon Sep 17 00:00:00 2001 From: LilithSilver <84940819+LilithSilver@users.noreply.github.com> Date: Tue, 14 May 2024 11:30:17 -0700 Subject: [PATCH 5/6] Dark mode (#299) --- LightBulb/App.axaml | 100 ++++++++++++++---- LightBulb/App.axaml.cs | 64 +++++++++-- LightBulb/LightBulb.csproj | 2 +- LightBulb/Models/ThemeMode.cs | 22 ++++ LightBulb/Services/SettingsService.cs | 3 + .../Settings/AdvancedSettingsTabViewModel.cs | 13 ++- LightBulb/ViewModels/MainViewModel.cs | 3 - .../Views/Components/DashboardView.axaml | 53 ++++++++-- .../Settings/AdvancedSettingsTabView.axaml | 41 +++++-- .../ApplicationWhitelistSettingsTabView.axaml | 6 +- .../Settings/GeneralSettingsTabView.axaml | 36 ++++--- .../Settings/LocationSettingsTabView.axaml | 21 ++-- LightBulb/Views/Controls/HotKeyTextBox.axaml | 3 +- LightBulb/Views/MainView.axaml | 5 +- 14 files changed, 299 insertions(+), 73 deletions(-) create mode 100644 LightBulb/Models/ThemeMode.cs diff --git a/LightBulb/App.axaml b/LightBulb/App.axaml index 80eb4467..13df9456 100644 --- a/LightBulb/App.axaml +++ b/LightBulb/App.axaml @@ -4,13 +4,15 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia" xmlns:framework="clr-namespace:LightBulb.Framework" + xmlns:sys="using:System" xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles" + xmlns:materialControls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles" xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" - xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles" - RequestedThemeVariant="Light"> + xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"> + + + + + + + + + + + + + + + + + + + + + @@ -104,25 +149,38 @@ - - - - - - + - - - + + + + + + + false + + + + + true + + + diff --git a/LightBulb/App.axaml.cs b/LightBulb/App.axaml.cs index a9dbce0a..10f1f123 100644 --- a/LightBulb/App.axaml.cs +++ b/LightBulb/App.axaml.cs @@ -5,8 +5,10 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; using Avalonia.Media; +using Avalonia.Platform; using Avalonia.Threading; using LightBulb.Framework; +using LightBulb.Models; using LightBulb.Services; using LightBulb.Utils; using LightBulb.Utils.Extensions; @@ -26,6 +28,7 @@ public class App : Application, IDisposable private readonly ServiceProvider _services; private readonly MainViewModel _mainViewModel; + private readonly SettingsService _settingsService; public App() { @@ -56,6 +59,22 @@ public App() _services = services.BuildServiceProvider(true); _mainViewModel = _services.GetRequiredService().CreateMainViewModel(); + _settingsService = _services.GetRequiredService(); + + // Load settings + _settingsService.Load(); + + _settingsService.WatchProperty( + o => o.Theme, + () => + { + if (PlatformSettings is IPlatformSettings settings) + { + SetupTheme(settings.GetColorValues()); + } + }, + false + ); } public override void Initialize() @@ -95,12 +114,45 @@ public override void OnFrameworkInitializationCompleted() base.OnFrameworkInitializationCompleted(); - // Set custom theme colors - this.LocateMaterialTheme().CurrentTheme = Theme.Create( - Theme.Light, - Color.Parse("#343838"), - Color.Parse("#F9A825") - ); + if (PlatformSettings is IPlatformSettings settings) + { + settings.ColorValuesChanged += PlatformSettings_ColorValuesChanged; + SetupTheme(settings.GetColorValues()); + } + } + + private void PlatformSettings_ColorValuesChanged(object? sender, PlatformColorValues colors) + { + SetupTheme(colors); + } + + private void SetupTheme(PlatformColorValues colors) + { + var themeMode = _settingsService.Theme; + if (themeMode == ThemeMode.System) + { + themeMode = + colors.ThemeVariant == PlatformThemeVariant.Dark ? ThemeMode.Dark : ThemeMode.Light; + } + + if (themeMode == ThemeMode.Dark) + { + RequestedThemeVariant = Avalonia.Styling.ThemeVariant.Dark; + this.LocateMaterialTheme().CurrentTheme = Theme.Create( + Theme.Dark, + Color.Parse("#202222"), + Color.Parse("#F9A825") + ); + } + else + { + RequestedThemeVariant = Avalonia.Styling.ThemeVariant.Light; + this.LocateMaterialTheme().CurrentTheme = Theme.Create( + Theme.Light, + Color.Parse("#343838"), + Color.Parse("#F9A825") + ); + } } private void TrayIcon_OnClicked(object? sender, EventArgs args) => this.TryFocusMainWindow(); diff --git a/LightBulb/LightBulb.csproj b/LightBulb/LightBulb.csproj index 4c826f6c..c13291ae 100644 --- a/LightBulb/LightBulb.csproj +++ b/LightBulb/LightBulb.csproj @@ -26,7 +26,7 @@ - + diff --git a/LightBulb/Models/ThemeMode.cs b/LightBulb/Models/ThemeMode.cs new file mode 100644 index 00000000..82d71c55 --- /dev/null +++ b/LightBulb/Models/ThemeMode.cs @@ -0,0 +1,22 @@ +namespace LightBulb.Models; + +/// +/// Describes the application's theme mode. +/// +public enum ThemeMode +{ + /// + /// Use the light theme + /// + Light, + + /// + /// Use the dark theme + /// + Dark, + + /// + /// Use whichever theme is specified by system settings + /// + System +} diff --git a/LightBulb/Services/SettingsService.cs b/LightBulb/Services/SettingsService.cs index f33cce70..c99f7957 100644 --- a/LightBulb/Services/SettingsService.cs +++ b/LightBulb/Services/SettingsService.cs @@ -88,6 +88,9 @@ public partial class SettingsService() : SettingsBase(GetFilePath()) [property: JsonIgnore] // comes from registry private bool _isAutoStartEnabled; + [ObservableProperty] + private ThemeMode _theme = ThemeMode.System; + [ObservableProperty] private bool _isAutoUpdateEnabled = true; diff --git a/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs b/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs index 4f8b2d04..059306f7 100644 --- a/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs +++ b/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs @@ -1,4 +1,7 @@ -using LightBulb.Services; +using System; +using System.Collections.Generic; +using LightBulb.Models; +using LightBulb.Services; namespace LightBulb.ViewModels.Components.Settings; @@ -11,6 +14,14 @@ public bool IsAutoStartEnabled set => SettingsService.IsAutoStartEnabled = value; } + public IReadOnlyList ThemeArray { get; } = Enum.GetValues(); + + public ThemeMode Theme + { + get => SettingsService.Theme; + set => SettingsService.Theme = value; + } + public bool IsAutoUpdateEnabled { get => SettingsService.IsAutoUpdateEnabled; diff --git a/LightBulb/ViewModels/MainViewModel.cs b/LightBulb/ViewModels/MainViewModel.cs index 39685004..531e8994 100644 --- a/LightBulb/ViewModels/MainViewModel.cs +++ b/LightBulb/ViewModels/MainViewModel.cs @@ -143,9 +143,6 @@ Click LEARN MORE to find ways that you can help. [RelayCommand] private async Task InitializeAsync() { - // Load settings - settingsService.Load(); - await FinalizePendingUpdateAsync(); await ShowGammaRangePromptAsync(); await ShowFirstTimeExperienceMessageAsync(); diff --git a/LightBulb/Views/Components/DashboardView.axaml b/LightBulb/Views/Components/DashboardView.axaml index 989f41f6..ad06e365 100644 --- a/LightBulb/Views/Components/DashboardView.axaml +++ b/LightBulb/Views/Components/DashboardView.axaml @@ -12,6 +12,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -57,14 +90,14 @@ Height="180" EndAngle="{Binding SunsetStart, Converter={x:Static converters:TimeOnlyToDegreesDoubleConverter.Instance}}" StartAngle="{Binding SunriseEnd, Converter={x:Static converters:TimeOnlyToDegreesDoubleConverter.Instance}}" - Stroke="#8AC0FF" + Stroke="{DynamicResource SundialDayBorderBrush}" StrokeThickness="28" /> @@ -73,14 +106,14 @@ Height="180" EndAngle="{Binding SunriseEnd, Converter={x:Static converters:TimeOnlyToDegreesDoubleConverter.Instance}}" StartAngle="{Binding SunriseStart, Converter={x:Static converters:TimeOnlyToDegreesDoubleConverter.Instance}}" - Stroke="#FFC766" + Stroke="{DynamicResource SundialSunriseBorderBrush}" StrokeThickness="28" /> @@ -89,14 +122,14 @@ Height="180" EndAngle="{Binding SunsetEnd, Converter={x:Static converters:TimeOnlyToDegreesDoubleConverter.Instance}}" StartAngle="{Binding SunsetStart, Converter={x:Static converters:TimeOnlyToDegreesDoubleConverter.Instance}}" - Stroke="#FFC766" + Stroke="{DynamicResource SundialSunsetBorderBrush}" StrokeThickness="28" /> @@ -104,13 +137,13 @@ Width="180" Height="180" Angle="{Binding Instant.TimeOfDay.TotalDays, Converter={x:Static converters:FractionToDegreesConverter.Instance}}" - Fill="#FF7733" + Fill="{DynamicResource SundialMarkerBorderBrush}" Size="28" /> diff --git a/LightBulb/Views/Components/Settings/AdvancedSettingsTabView.axaml b/LightBulb/Views/Components/Settings/AdvancedSettingsTabView.axaml index b897a8cb..87df660e 100644 --- a/LightBulb/Views/Components/Settings/AdvancedSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/AdvancedSettingsTabView.axaml @@ -18,11 +18,33 @@ HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Right" - IsChecked="{Binding IsAutoStartEnabled}" /> + IsChecked="{Binding IsAutoStartEnabled}" + Classes.accent="{DynamicResource UseAccentControls}" /> + + + + + + + + + + + + + - + + IsChecked="{Binding IsAutoUpdateEnabled}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -44,7 +67,8 @@ HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Right" - IsChecked="{Binding IsDefaultToDayConfigurationEnabled}" /> + IsChecked="{Binding IsDefaultToDayConfigurationEnabled}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -57,7 +81,8 @@ HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Right" - IsChecked="{Binding IsPauseWhenFullScreenEnabled}" /> + IsChecked="{Binding IsPauseWhenFullScreenEnabled}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -70,7 +95,8 @@ HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Right" - IsChecked="{Binding IsConfigurationSmoothingEnabled}" /> + IsChecked="{Binding IsConfigurationSmoothingEnabled}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -83,7 +109,8 @@ HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Right" - IsChecked="{Binding IsGammaPollingEnabled}" /> + IsChecked="{Binding IsGammaPollingEnabled}" + Classes.accent="{DynamicResource UseAccentControls}" /> \ No newline at end of file diff --git a/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml b/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml index a97a14bd..22a0d902 100644 --- a/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml @@ -42,7 +42,8 @@ HorizontalAlignment="Right" VerticalAlignment="Center" IsChecked="{Binding IsApplicationWhitelistEnabled}" - ToolTip.Tip="Pause LightBulb when one of the selected applications is in the foreground" /> + ToolTip.Tip="Pause LightBulb when one of the selected applications is in the foreground" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -69,7 +70,8 @@ + IsHitTestVisible="False" + Classes.accent="{DynamicResource UseAccentControls}"/> diff --git a/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml b/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml index 621f4668..d1db4102 100644 --- a/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml @@ -17,7 +17,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -31,7 +32,8 @@ Minimum="2500" SmallChange="100" TickFrequency="20" - Value="{Binding DayTemperature}" /> + Value="{Binding DayTemperature}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -40,7 +42,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -54,7 +57,8 @@ Minimum="2500" SmallChange="100" TickFrequency="20" - Value="{Binding NightTemperature}" /> + Value="{Binding NightTemperature}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -76,7 +80,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -90,7 +95,8 @@ Minimum="0.1" SmallChange="0.01" TickFrequency="0.01" - Value="{Binding DayBrightness}" /> + Value="{Binding DayBrightness}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -112,7 +118,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -126,7 +133,8 @@ Minimum="0.1" SmallChange="0.01" TickFrequency="0.01" - Value="{Binding NightBrightness}" /> + Value="{Binding NightBrightness}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -135,7 +143,8 @@ MinWidth="48" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -147,7 +156,8 @@ Maximum="3" Minimum="0" SmallChange="0.08" - Value="{Binding ConfigurationTransitionDuration, Converter={x:Static converters:TimeSpanToHoursDoubleConverter.Instance}}" /> + Value="{Binding ConfigurationTransitionDuration, Converter={x:Static converters:TimeSpanToHoursDoubleConverter.Instance}}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -156,7 +166,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -168,6 +179,7 @@ Maximum="1" Minimum="0" SmallChange="0.01" - Value="{Binding ConfigurationTransitionOffset}" /> + Value="{Binding ConfigurationTransitionOffset}" + Classes.accent="{DynamicResource UseAccentControls}" /> \ No newline at end of file diff --git a/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml b/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml index 7a55f835..86edeb4c 100644 --- a/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml @@ -18,13 +18,15 @@ Content="Manual" DockPanel.Dock="Left" IsChecked="{Binding IsManualSunriseSunsetEnabled}" - ToolTip.Tip="Configure sunrise and sunset manually" /> + ToolTip.Tip="Configure sunrise and sunset manually" + Classes.accent="{DynamicResource UseAccentControls}" /> + ToolTip.Tip="Configure your location and use it to automatically calculate the sunrise and sunset times" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -39,7 +41,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -51,7 +54,8 @@ Maximum="23.99999" Minimum="0" SmallChange="0.25" - Value="{Binding ManualSunrise, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" /> + Value="{Binding ManualSunrise, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -60,7 +64,8 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> @@ -72,7 +77,8 @@ Maximum="23.99999" Minimum="0" SmallChange="0.25" - Value="{Binding ManualSunset, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" /> + Value="{Binding ManualSunset, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" + Classes.accent="{DynamicResource UseAccentControls}" /> @@ -104,7 +110,8 @@ VerticalAlignment="Center" IsEnabled="{Binding !IsBusy}" Text="{Binding LocationQuery}" - Theme="{DynamicResource CompactTextBox}"> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}"> diff --git a/LightBulb/Views/Controls/HotKeyTextBox.axaml b/LightBulb/Views/Controls/HotKeyTextBox.axaml index 7777ecf9..2c81dd70 100644 --- a/LightBulb/Views/Controls/HotKeyTextBox.axaml +++ b/LightBulb/Views/Controls/HotKeyTextBox.axaml @@ -8,5 +8,6 @@ IsUndoEnabled="False" Text="{Binding $parent[UserControl].HotKey, Mode=OneWay}" TextAlignment="Center" - Theme="{DynamicResource CompactTextBox}" /> + Theme="{DynamicResource CompactTextBox}" + Classes.accent="{DynamicResource UseAccentControls}" /> diff --git a/LightBulb/Views/MainView.axaml b/LightBulb/Views/MainView.axaml index d896487b..0d8b759e 100644 --- a/LightBulb/Views/MainView.axaml +++ b/LightBulb/Views/MainView.axaml @@ -35,6 +35,7 @@ Background="{DynamicResource MaterialPrimaryMidBrush}" PointerPressed="HeaderBorder_OnPointerPressed"> + + ToolTip.Tip="Toggle LightBulb on/off" + Classes="primary"> From 03218e810537043a70328cac3a924199d29f2037 Mon Sep 17 00:00:00 2001 From: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 14 May 2024 21:30:35 +0300 Subject: [PATCH 6/6] Refactor dark mode --- .../LightBulb.Core.Tests.csproj | 6 +- LightBulb.Core/LightBulb.Core.csproj | 2 +- .../LightBulb.PlatformInterop.csproj | 2 +- LightBulb/App.axaml | 106 +++++---------- LightBulb/App.axaml.cs | 109 +++++++-------- LightBulb/Framework/ThemeVariant.cs | 8 ++ LightBulb/LightBulb.csproj | 8 +- LightBulb/Models/ThemeMode.cs | 22 --- LightBulb/Services/SettingsService.cs | 7 +- .../Settings/AdvancedSettingsTabViewModel.cs | 18 +-- .../Views/Components/DashboardView.axaml | 64 +++++---- .../Settings/AdvancedSettingsTabView.axaml | 128 ++++++------------ .../ApplicationWhitelistSettingsTabView.axaml | 6 +- .../Settings/GeneralSettingsTabView.axaml | 36 ++--- .../Settings/LocationSettingsTabView.axaml | 21 +-- LightBulb/Views/Controls/HotKeyTextBox.axaml | 3 +- LightBulb/Views/Dialogs/SettingsView.axaml | 10 +- LightBulb/Views/MainView.axaml | 15 +- 18 files changed, 228 insertions(+), 343 deletions(-) create mode 100644 LightBulb/Framework/ThemeVariant.cs delete mode 100644 LightBulb/Models/ThemeMode.cs diff --git a/LightBulb.Core.Tests/LightBulb.Core.Tests.csproj b/LightBulb.Core.Tests/LightBulb.Core.Tests.csproj index b829b6de..ba4c9c8f 100644 --- a/LightBulb.Core.Tests/LightBulb.Core.Tests.csproj +++ b/LightBulb.Core.Tests/LightBulb.Core.Tests.csproj @@ -11,12 +11,12 @@ - + - - + + diff --git a/LightBulb.Core/LightBulb.Core.csproj b/LightBulb.Core/LightBulb.Core.csproj index 9cb25d06..35a9f206 100644 --- a/LightBulb.Core/LightBulb.Core.csproj +++ b/LightBulb.Core/LightBulb.Core.csproj @@ -1,7 +1,7 @@ - + diff --git a/LightBulb.PlatformInterop/LightBulb.PlatformInterop.csproj b/LightBulb.PlatformInterop/LightBulb.PlatformInterop.csproj index 5e9e81f4..a37e6f7e 100644 --- a/LightBulb.PlatformInterop/LightBulb.PlatformInterop.csproj +++ b/LightBulb.PlatformInterop/LightBulb.PlatformInterop.csproj @@ -1,7 +1,7 @@  - + \ No newline at end of file diff --git a/LightBulb/App.axaml b/LightBulb/App.axaml index 13df9456..820c0ee1 100644 --- a/LightBulb/App.axaml +++ b/LightBulb/App.axaml @@ -4,29 +4,42 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dialogHostAvalonia="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia" xmlns:framework="clr-namespace:LightBulb.Framework" - xmlns:sys="using:System" xmlns:materialAssists="clr-namespace:Material.Styles.Assists;assembly=Material.Styles" - xmlns:materialControls="clr-namespace:Material.Styles.Controls;assembly=Material.Styles" xmlns:materialIcons="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" - xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"> + xmlns:materialStyles="clr-namespace:Material.Styles.Themes;assembly=Material.Styles" + ActualThemeVariantChanged="Application_OnActualThemeVariantChanged"> - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - @@ -150,6 +120,15 @@ + + + + + + + + + + - - - - - false - - - - - true - - diff --git a/LightBulb/App.axaml.cs b/LightBulb/App.axaml.cs index 10f1f123..4adbe507 100644 --- a/LightBulb/App.axaml.cs +++ b/LightBulb/App.axaml.cs @@ -8,7 +8,6 @@ using Avalonia.Platform; using Avalonia.Threading; using LightBulb.Framework; -using LightBulb.Models; using LightBulb.Services; using LightBulb.Utils; using LightBulb.Utils.Extensions; @@ -27,8 +26,8 @@ public class App : Application, IDisposable private readonly DisposableCollector _eventRoot = new(); private readonly ServiceProvider _services; - private readonly MainViewModel _mainViewModel; private readonly SettingsService _settingsService; + private readonly MainViewModel _mainViewModel; public App() { @@ -58,30 +57,29 @@ public App() services.AddTransient(); _services = services.BuildServiceProvider(true); - _mainViewModel = _services.GetRequiredService().CreateMainViewModel(); _settingsService = _services.GetRequiredService(); + _mainViewModel = _services.GetRequiredService().CreateMainViewModel(); - // Load settings - _settingsService.Load(); - - _settingsService.WatchProperty( - o => o.Theme, - () => - { - if (PlatformSettings is IPlatformSettings settings) + // Re-initialize the theme when the user changes it + _eventRoot.Add( + _settingsService.WatchProperty( + o => o.Theme, + () => { - SetupTheme(settings.GetColorValues()); - } - }, - false + RequestedThemeVariant = _settingsService.Theme switch + { + ThemeVariant.Light => Avalonia.Styling.ThemeVariant.Light, + ThemeVariant.Dark => Avalonia.Styling.ThemeVariant.Dark, + _ => Avalonia.Styling.ThemeVariant.Default + }; + + InitializeTheme(); + }, + false + ) ); - } - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - - // Tray icon does not support binding so we use this hack to update its tooltip + // Tray icon does not support binding so we use this hack to synchronize its tooltip _eventRoot.Add( _mainViewModel.Dashboard.WatchProperties( [o => o.IsActive, o => o.CurrentConfiguration], @@ -102,59 +100,52 @@ public override void Initialize() if (TrayIcon.GetIcons(this)?.FirstOrDefault() is { } trayIcon) trayIcon.ToolTipText = tooltip; }); - } + }, + false ) ); } - public override void OnFrameworkInitializationCompleted() + public override void Initialize() { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) - desktopLifetime.MainWindow = new MainView { DataContext = _mainViewModel }; - - base.OnFrameworkInitializationCompleted(); + base.Initialize(); - if (PlatformSettings is IPlatformSettings settings) - { - settings.ColorValuesChanged += PlatformSettings_ColorValuesChanged; - SetupTheme(settings.GetColorValues()); - } + AvaloniaXamlLoader.Load(this); } - private void PlatformSettings_ColorValuesChanged(object? sender, PlatformColorValues colors) + private void InitializeTheme() { - SetupTheme(colors); + var actualTheme = RequestedThemeVariant?.Key switch + { + "Light" => PlatformThemeVariant.Light, + "Dark" => PlatformThemeVariant.Dark, + _ => PlatformSettings?.GetColorValues().ThemeVariant ?? PlatformThemeVariant.Light + }; + + this.LocateMaterialTheme().CurrentTheme = + actualTheme == PlatformThemeVariant.Light + ? Theme.Create(Theme.Light, Color.Parse("#343838"), Color.Parse("#F9A825")) + : Theme.Create(Theme.Dark, Color.Parse("#E8E8E8"), Color.Parse("#F9A825")); } - private void SetupTheme(PlatformColorValues colors) + public override void OnFrameworkInitializationCompleted() { - var themeMode = _settingsService.Theme; - if (themeMode == ThemeMode.System) - { - themeMode = - colors.ThemeVariant == PlatformThemeVariant.Dark ? ThemeMode.Dark : ThemeMode.Light; - } + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) + desktopLifetime.MainWindow = new MainView { DataContext = _mainViewModel }; - if (themeMode == ThemeMode.Dark) - { - RequestedThemeVariant = Avalonia.Styling.ThemeVariant.Dark; - this.LocateMaterialTheme().CurrentTheme = Theme.Create( - Theme.Dark, - Color.Parse("#202222"), - Color.Parse("#F9A825") - ); - } - else - { - RequestedThemeVariant = Avalonia.Styling.ThemeVariant.Light; - this.LocateMaterialTheme().CurrentTheme = Theme.Create( - Theme.Light, - Color.Parse("#343838"), - Color.Parse("#F9A825") - ); - } + base.OnFrameworkInitializationCompleted(); + + // Set up custom theme colors + InitializeTheme(); + + // Load settings + _settingsService.Load(); } + private void Application_OnActualThemeVariantChanged(object? sender, EventArgs args) => + // Re-initialize the theme when the system theme changes + InitializeTheme(); + private void TrayIcon_OnClicked(object? sender, EventArgs args) => this.TryFocusMainWindow(); private void ShowSettingsMenuItem_OnClick(object? sender, EventArgs args) diff --git a/LightBulb/Framework/ThemeVariant.cs b/LightBulb/Framework/ThemeVariant.cs new file mode 100644 index 00000000..4a062ad7 --- /dev/null +++ b/LightBulb/Framework/ThemeVariant.cs @@ -0,0 +1,8 @@ +namespace LightBulb.Framework; + +public enum ThemeVariant +{ + System, + Light, + Dark +} diff --git a/LightBulb/LightBulb.csproj b/LightBulb/LightBulb.csproj index c13291ae..00c8e753 100644 --- a/LightBulb/LightBulb.csproj +++ b/LightBulb/LightBulb.csproj @@ -19,14 +19,14 @@ - + - + - - + + diff --git a/LightBulb/Models/ThemeMode.cs b/LightBulb/Models/ThemeMode.cs deleted file mode 100644 index 82d71c55..00000000 --- a/LightBulb/Models/ThemeMode.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace LightBulb.Models; - -/// -/// Describes the application's theme mode. -/// -public enum ThemeMode -{ - /// - /// Use the light theme - /// - Light, - - /// - /// Use the dark theme - /// - Dark, - - /// - /// Use whichever theme is specified by system settings - /// - System -} diff --git a/LightBulb/Services/SettingsService.cs b/LightBulb/Services/SettingsService.cs index c99f7957..e85a80b2 100644 --- a/LightBulb/Services/SettingsService.cs +++ b/LightBulb/Services/SettingsService.cs @@ -5,6 +5,7 @@ using Cogwheel; using CommunityToolkit.Mvvm.ComponentModel; using LightBulb.Core; +using LightBulb.Framework; using LightBulb.Models; using LightBulb.PlatformInterop; using LightBulb.Utils; @@ -85,11 +86,11 @@ public partial class SettingsService() : SettingsBase(GetFilePath()) // Advanced [ObservableProperty] - [property: JsonIgnore] // comes from registry - private bool _isAutoStartEnabled; + private ThemeVariant _theme; [ObservableProperty] - private ThemeMode _theme = ThemeMode.System; + [property: JsonIgnore] // comes from registry + private bool _isAutoStartEnabled; [ObservableProperty] private bool _isAutoUpdateEnabled = true; diff --git a/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs b/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs index 059306f7..7cb85f9d 100644 --- a/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs +++ b/LightBulb/ViewModels/Components/Settings/AdvancedSettingsTabViewModel.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using LightBulb.Models; +using LightBulb.Framework; using LightBulb.Services; namespace LightBulb.ViewModels.Components.Settings; @@ -8,20 +8,20 @@ namespace LightBulb.ViewModels.Components.Settings; public class AdvancedSettingsTabViewModel(SettingsService settingsService) : SettingsTabViewModelBase(settingsService, 2, "Advanced") { - public bool IsAutoStartEnabled - { - get => SettingsService.IsAutoStartEnabled; - set => SettingsService.IsAutoStartEnabled = value; - } - - public IReadOnlyList ThemeArray { get; } = Enum.GetValues(); + public IReadOnlyList AvailableThemes { get; } = Enum.GetValues(); - public ThemeMode Theme + public ThemeVariant Theme { get => SettingsService.Theme; set => SettingsService.Theme = value; } + public bool IsAutoStartEnabled + { + get => SettingsService.IsAutoStartEnabled; + set => SettingsService.IsAutoStartEnabled = value; + } + public bool IsAutoUpdateEnabled { get => SettingsService.IsAutoUpdateEnabled; diff --git a/LightBulb/Views/Components/DashboardView.axaml b/LightBulb/Views/Components/DashboardView.axaml index ad06e365..349bab77 100644 --- a/LightBulb/Views/Components/DashboardView.axaml +++ b/LightBulb/Views/Components/DashboardView.axaml @@ -12,39 +12,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + ItemsSource="{Binding AvailableThemes}" + SelectedItem="{Binding Theme}" /> - - - - - - - - - - - + + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + \ No newline at end of file diff --git a/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml b/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml index 22a0d902..a97a14bd 100644 --- a/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/ApplicationWhitelistSettingsTabView.axaml @@ -42,8 +42,7 @@ HorizontalAlignment="Right" VerticalAlignment="Center" IsChecked="{Binding IsApplicationWhitelistEnabled}" - ToolTip.Tip="Pause LightBulb when one of the selected applications is in the foreground" - Classes.accent="{DynamicResource UseAccentControls}" /> + ToolTip.Tip="Pause LightBulb when one of the selected applications is in the foreground" /> @@ -70,8 +69,7 @@ + IsHitTestVisible="False" /> diff --git a/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml b/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml index d1db4102..621f4668 100644 --- a/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/GeneralSettingsTabView.axaml @@ -17,8 +17,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -32,8 +31,7 @@ Minimum="2500" SmallChange="100" TickFrequency="20" - Value="{Binding DayTemperature}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding DayTemperature}" /> @@ -42,8 +40,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -57,8 +54,7 @@ Minimum="2500" SmallChange="100" TickFrequency="20" - Value="{Binding NightTemperature}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding NightTemperature}" /> @@ -80,8 +76,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -95,8 +90,7 @@ Minimum="0.1" SmallChange="0.01" TickFrequency="0.01" - Value="{Binding DayBrightness}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding DayBrightness}" /> @@ -118,8 +112,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -133,8 +126,7 @@ Minimum="0.1" SmallChange="0.01" TickFrequency="0.01" - Value="{Binding NightBrightness}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding NightBrightness}" /> @@ -143,8 +135,7 @@ MinWidth="48" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -156,8 +147,7 @@ Maximum="3" Minimum="0" SmallChange="0.08" - Value="{Binding ConfigurationTransitionDuration, Converter={x:Static converters:TimeSpanToHoursDoubleConverter.Instance}}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding ConfigurationTransitionDuration, Converter={x:Static converters:TimeSpanToHoursDoubleConverter.Instance}}" /> @@ -166,8 +156,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -179,7 +168,6 @@ Maximum="1" Minimum="0" SmallChange="0.01" - Value="{Binding ConfigurationTransitionOffset}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding ConfigurationTransitionOffset}" /> \ No newline at end of file diff --git a/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml b/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml index 86edeb4c..7a55f835 100644 --- a/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml +++ b/LightBulb/Views/Components/Settings/LocationSettingsTabView.axaml @@ -18,15 +18,13 @@ Content="Manual" DockPanel.Dock="Left" IsChecked="{Binding IsManualSunriseSunsetEnabled}" - ToolTip.Tip="Configure sunrise and sunset manually" - Classes.accent="{DynamicResource UseAccentControls}" /> + ToolTip.Tip="Configure sunrise and sunset manually" /> + ToolTip.Tip="Configure your location and use it to automatically calculate the sunrise and sunset times" /> @@ -41,8 +39,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -54,8 +51,7 @@ Maximum="23.99999" Minimum="0" SmallChange="0.25" - Value="{Binding ManualSunrise, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding ManualSunrise, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" /> @@ -64,8 +60,7 @@ MinWidth="24" HorizontalAlignment="Right" DockPanel.Dock="Right" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> @@ -77,8 +72,7 @@ Maximum="23.99999" Minimum="0" SmallChange="0.25" - Value="{Binding ManualSunset, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Value="{Binding ManualSunset, Converter={x:Static converters:TimeOnlyToHoursDoubleConverter.Instance}}" /> @@ -110,8 +104,7 @@ VerticalAlignment="Center" IsEnabled="{Binding !IsBusy}" Text="{Binding LocationQuery}" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}"> + Theme="{DynamicResource CompactTextBox}"> diff --git a/LightBulb/Views/Controls/HotKeyTextBox.axaml b/LightBulb/Views/Controls/HotKeyTextBox.axaml index 2c81dd70..7777ecf9 100644 --- a/LightBulb/Views/Controls/HotKeyTextBox.axaml +++ b/LightBulb/Views/Controls/HotKeyTextBox.axaml @@ -8,6 +8,5 @@ IsUndoEnabled="False" Text="{Binding $parent[UserControl].HotKey, Mode=OneWay}" TextAlignment="Center" - Theme="{DynamicResource CompactTextBox}" - Classes.accent="{DynamicResource UseAccentControls}" /> + Theme="{DynamicResource CompactTextBox}" /> diff --git a/LightBulb/Views/Dialogs/SettingsView.axaml b/LightBulb/Views/Dialogs/SettingsView.axaml index 94123461..05facd5b 100644 --- a/LightBulb/Views/Dialogs/SettingsView.axaml +++ b/LightBulb/Views/Dialogs/SettingsView.axaml @@ -16,8 +16,8 @@ - + Background="{DynamicResource MaterialDarkBackgroundBrush}"> + @@ -45,11 +45,13 @@ - + diff --git a/LightBulb/Views/MainView.axaml b/LightBulb/Views/MainView.axaml index 0d8b759e..c137fd97 100644 --- a/LightBulb/Views/MainView.axaml +++ b/LightBulb/Views/MainView.axaml @@ -21,7 +21,10 @@ - + - + ToolTip.Tip="Toggle LightBulb on/off"> @@ -68,7 +71,7 @@ Margin="8,1,0,0" VerticalAlignment="Center" FontSize="16" - Foreground="{DynamicResource MaterialPrimaryMidForegroundBrush}"> + Foreground="{DynamicResource MaterialDarkForegroundBrush}">