Skip to content

Commit c3af5f0

Browse files
authored
Feature: Switched color customization to strings (#10869)
1 parent 1c6e41b commit c3af5f0

File tree

5 files changed

+23
-21
lines changed

5 files changed

+23
-21
lines changed

src/Files.App (Package)/Package.appxmanifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
1010
xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5"
1111
IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
12-
<Identity Name="FilesDev" Publisher="CN=Files" Version="2.4.8.0" />
12+
<Identity Name="FilesDev" Publisher="CN=Files" Version="2.4.9.0" />
1313
<Properties>
1414
<DisplayName>Files - Dev</DisplayName>
1515
<PublisherDisplayName>Yair A</PublisherDisplayName>

src/Files.App/ServicesImplementation/Settings/AppearanceSettingsService.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,30 +129,30 @@ public bool BundlesWidgetExpanded
129129
}
130130

131131
/// <inheritdoc/>
132-
public UInt32 AppThemeBackgroundColor
132+
public String AppThemeBackgroundColor
133133
{
134-
get => Get(uint.MinValue);
134+
get => Get("#00000000");
135135
set => Set(value);
136136
}
137137

138138
/// <inheritdoc/>
139-
public UInt32 AppThemeAddressBarBackgroundColor
139+
public String AppThemeAddressBarBackgroundColor
140140
{
141-
get => Get(uint.MinValue);
141+
get => Get("#00000000");
142142
set => Set(value);
143143
}
144144

145145
/// <inheritdoc/>
146-
public UInt32 AppThemeSidebarBackgroundColor
146+
public String AppThemeSidebarBackgroundColor
147147
{
148-
get => Get(uint.MinValue);
148+
get => Get("#00000000");
149149
set => Set(value);
150150
}
151151

152152
/// <inheritdoc/>
153-
public UInt32 AppThemeFileAreaBackgroundColor
153+
public String AppThemeFileAreaBackgroundColor
154154
{
155-
get => Get(uint.MinValue);
155+
get => Get("#00000000");
156156
set => Set(value);
157157
}
158158

src/Files.App/ViewModels/SettingsViewModels/AppearanceViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using CommunityToolkit.Mvvm.ComponentModel;
22
using CommunityToolkit.Mvvm.DependencyInjection;
33
using CommunityToolkit.Mvvm.Input;
4+
using CommunityToolkit.WinUI.Helpers;
45
using Files.App.Extensions;
56
using Files.App.Helpers;
67
using Files.App.Views.SettingsPages.Appearance;
@@ -259,12 +260,12 @@ public bool ShowRecentFilesWidget
259260

260261
public Color AppThemeBackgroundColor
261262
{
262-
get => ColorHelpers.FromUint(UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor);
263+
get => ColorHelper.ToColor(UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor);
263264
set
264265
{
265-
if (ColorHelpers.ToUint(value) != UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor)
266+
if (value != ColorHelper.ToColor(UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor))
266267
{
267-
UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor = ColorHelpers.ToUint(value);
268+
UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor = value.ToString();
268269

269270
App.AppThemeResourcesHelper.SetAppThemeBackgroundColor(AppThemeBackgroundColor);
270271
App.AppThemeResourcesHelper.ApplyResources();

src/Files.App/Views/MainPage.xaml.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
using Windows.Services.Store;
3131
using Windows.Storage;
3232
using Windows.UI;
33+
using ColorHelper = CommunityToolkit.WinUI.Helpers.ColorHelper;
3334

3435
namespace Files.App.Views
3536
{
@@ -83,10 +84,10 @@ public MainPage()
8384
private void LoadAppResources()
8485
{
8586
var useCompactStyles = UserSettingsService.AppearanceSettingsService.UseCompactStyles;
86-
var appThemeBackgroundColor = ColorHelpers.FromUint(UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor);
87-
var appThemeAddressBarBackgroundColor = ColorHelpers.FromUint(UserSettingsService.AppearanceSettingsService.AppThemeAddressBarBackgroundColor);
88-
var appThemeSidebarBackgroundColor = ColorHelpers.FromUint(UserSettingsService.AppearanceSettingsService.AppThemeSidebarBackgroundColor);
89-
var appThemeFileAreaBackgroundColor = ColorHelpers.FromUint(UserSettingsService.AppearanceSettingsService.AppThemeFileAreaBackgroundColor);
87+
var appThemeBackgroundColor = ColorHelper.ToColor(UserSettingsService.AppearanceSettingsService.AppThemeBackgroundColor);
88+
var appThemeAddressBarBackgroundColor = ColorHelper.ToColor(UserSettingsService.AppearanceSettingsService.AppThemeAddressBarBackgroundColor);
89+
var appThemeSidebarBackgroundColor = ColorHelper.ToColor(UserSettingsService.AppearanceSettingsService.AppThemeSidebarBackgroundColor);
90+
var appThemeFileAreaBackgroundColor = ColorHelper.ToColor(UserSettingsService.AppearanceSettingsService.AppThemeFileAreaBackgroundColor);
9091
var appThemeFontFamily = UserSettingsService.AppearanceSettingsService.AppThemeFontFamily;
9192

9293
App.AppThemeResourcesHelper.SetCompactSpacing(useCompactStyles);

src/Files.Backend/Services/Settings/IAppearanceSettingsService.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
107107
/// <summary>
108108
/// Gets or sets a value for the app theme background color.
109109
/// </summary>
110-
UInt32 AppThemeBackgroundColor { get; set; }
110+
String AppThemeBackgroundColor { get; set; }
111111

112112
/// <summary>
113113
/// Gets or sets a value for the app theme address bar background color.
114114
/// </summary>
115-
UInt32 AppThemeAddressBarBackgroundColor { get; set; }
116-
115+
String AppThemeAddressBarBackgroundColor { get; set; }
116+
117117
/// <summary>
118118
/// Gets or sets a value for the app theme sidebar background color.
119119
/// </summary>
120-
UInt32 AppThemeSidebarBackgroundColor { get; set; }
120+
String AppThemeSidebarBackgroundColor { get; set; }
121121

122122
/// <summary>
123123
/// Gets or sets a value for the app theme file area background color.
124124
/// </summary>
125-
UInt32 AppThemeFileAreaBackgroundColor { get; set; }
125+
String AppThemeFileAreaBackgroundColor { get; set; }
126126

127127
/// <summary>
128128
/// Gets or sets a value for the app theme font family.

0 commit comments

Comments
 (0)