Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental/new titlebar and navigationview style #296

Merged
merged 7 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion FluentLauncher.Localization
24 changes: 24 additions & 0 deletions Natsurainko.FluentLauncher/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,36 @@
<SolidColorBrush x:Key="DeleteButtonBorder" Color="#BFCC0000" />
<Color x:Key="AcrylicTintColor">White</Color>
<SolidColorBrush x:Key="IconBorder" Color="#25000000" />
<AcrylicBrush
x:Key="NavigationViewUnfoldedPaneBackground"
FallbackColor="#D0EEEEEE"
TintColor="#EEEEEE"
TintLuminosityOpacity="0.9"
TintOpacity="0.0" />
<AcrylicBrush
x:Key="BackgroundImageMaskAcrylicBrush"
FallbackColor="#E0EEEEEE"
TintColor="#EEEEEE"
TintLuminosityOpacity="0.9"
TintOpacity="0.4" />
</ResourceDictionary>
<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="DeleteButtonBackground" Color="#3FFF0000" />
<SolidColorBrush x:Key="DeleteButtonBorder" Color="#59FF0000" />
<Color x:Key="AcrylicTintColor">Black</Color>
<SolidColorBrush x:Key="IconBorder" Color="#10FFFFFF" />
<AcrylicBrush
x:Key="NavigationViewUnfoldedPaneBackground"
FallbackColor="#AA222222"
TintColor="#222222"
TintLuminosityOpacity="0.5"
TintOpacity="0.0" />
<AcrylicBrush
x:Key="BackgroundImageMaskAcrylicBrush"
FallbackColor="#EE222222"
TintColor="#222222"
TintLuminosityOpacity="0.7"
TintOpacity="0.0" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

Expand Down
4 changes: 3 additions & 1 deletion Natsurainko.FluentLauncher/Services/UI/AppearanceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ public void RegisterWindow(Window window)
case 0:
if (MicaController.IsSupported())
RegisteredWindow!.SystemBackdrop = new MicaBackdrop() { Kind = (MicaKind)_settingsService.MicaKind };
control.Background = new SolidColorBrush(Colors.Transparent);
break;
case 1:
if (DesktopAcrylicController.IsSupported())
RegisteredWindow!.SystemBackdrop = new DesktopAcrylicBackdrop();
RegisteredWindow!.SystemBackdrop = new DesktopAcrylicBackdrop();
control.Background = new SolidColorBrush(Colors.Transparent);
break;
case 2:
control.Background = _settingsService.SolidSelectedIndex == 0 || _settingsService.CustomBackgroundColor == null
Expand Down
10 changes: 7 additions & 3 deletions Natsurainko.FluentLauncher/Views/Home/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Loaded="Page_Loaded"
mc:Ignorable="d">
<Page.Resources>
<ThemeShadow x:Name="SharedShadow" />
<Style x:Key="DropDownButtonStyle" TargetType="DropDownButton">
<Setter Property="Background" Value="{ThemeResource ButtonBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ButtonForeground}" />
Expand Down Expand Up @@ -192,12 +193,13 @@
Name="HyperlinkButtonArea"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="{ThemeResource ControlCornerRadius}" />
CornerRadius="8" />
<HyperlinkButton
Name="HyperlinkButton"
Background="Transparent"
BorderBrush="Transparent"
Command="{Binding GoToAccountCommand}">
Command="{Binding GoToAccountCommand}"
CornerRadius="8">
<StackPanel>
<TextBlock
Foreground="{ThemeResource ApplicationSecondaryForegroundThemeBrush}"
Expand All @@ -212,6 +214,7 @@
Grid.Column="4"
VerticalAlignment="Bottom"
Command="{Binding LaunchCommand}"
CornerRadius="8"
Style="{ThemeResource AccentButtonStyle}">
<ToolTipService.ToolTip>
<TextBlock x:Uid="Home_HomePage_LaunchButton" />
Expand Down Expand Up @@ -246,12 +249,13 @@
Name="DropDownButtonArea"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CornerRadius="{ThemeResource ControlCornerRadius}" />
CornerRadius="8" />
<DropDownButton
x:Name="DropDownButton"
Background="Transparent"
BorderBrush="Transparent"
Click="DropDownButton_Click"
CornerRadius="8"
Style="{ThemeResource DropDownButtonStyle}">
<TextBlock
Grid.Column="2"
Expand Down
33 changes: 14 additions & 19 deletions Natsurainko.FluentLauncher/Views/Home/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace Natsurainko.FluentLauncher.Views.Home;

public sealed partial class HomePage : Page
{
private readonly ThemeShadow _themeShadow = new();
private readonly SettingsService _settingsService = App.GetService<SettingsService>();

public HomePage()
Expand All @@ -20,41 +19,37 @@ public HomePage()

private void Page_Loaded(object sender, RoutedEventArgs e)
{
_themeShadow.Receivers.Add(Grid);
var themeDictionaries = (App.Current.Resources.ThemeDictionaries[this.ActualTheme == ElementTheme.Light ? "Light" : "Dark"] as ResourceDictionary)!;

if (_settingsService.UseHomeControlsMask)
{
Brush maskColorBrush = this.ActualTheme == ElementTheme.Light
? new SolidColorBrush(Color.FromArgb(128, 255, 255, 255))
: new SolidColorBrush(Color.FromArgb(76, 58, 58, 58));

Brush foregroundBrush = this.ActualTheme == ElementTheme.Light
? new SolidColorBrush(Color.FromArgb(255, 26, 26, 26))
: new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));

DropDownButton.Shadow = _themeShadow;
DropDownButton.Translation += new System.Numerics.Vector3(0, 0, 32);
DropDownButtonArea.Background = new CommunityToolkit.WinUI.Media.BackdropBlurBrush() { Amount = 16 };
DropDownButton.Background = maskColorBrush;
LaunchButton.Shadow = SharedShadow;
LaunchButton.Translation += new System.Numerics.Vector3(0, 0, 16);

DropDownButton.Shadow = SharedShadow;
DropDownButton.Translation += new System.Numerics.Vector3(0, 0, 16);
DropDownButtonArea.Background = themeDictionaries["NavigationViewUnfoldedPaneBackground"] as AcrylicBrush;

HyperlinkButton.Shadow = _themeShadow;
HyperlinkButton.Translation += new System.Numerics.Vector3(0, 0, 32);
HyperlinkButtonArea.Background = new CommunityToolkit.WinUI.Media.BackdropBlurBrush() { Amount = 16 };
HyperlinkButton.Background = maskColorBrush;
HyperlinkButton.Shadow = SharedShadow;
HyperlinkButton.Translation += new System.Numerics.Vector3(0, 0, 16);
HyperlinkButtonArea.Background = themeDictionaries["NavigationViewUnfoldedPaneBackground"] as AcrylicBrush;
HyperlinkButton.Foreground = foregroundBrush;

this.ActualThemeChanged += (_, e) =>
{
Brush maskColorBrush = this.ActualTheme == ElementTheme.Light
? new SolidColorBrush(Color.FromArgb(128, 255, 255, 255))
: new SolidColorBrush(Color.FromArgb(76, 58, 58, 58));
var themeDictionaries = (App.Current.Resources.ThemeDictionaries[this.ActualTheme == ElementTheme.Light ? "Light" : "Dark"] as ResourceDictionary)!;

Brush foregroundBrush = this.ActualTheme == ElementTheme.Light
? new SolidColorBrush(Color.FromArgb(255, 26, 26, 26))
: new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));

DropDownButton.Background = maskColorBrush;
HyperlinkButton.Background = maskColorBrush;
DropDownButtonArea.Background = themeDictionaries["NavigationViewUnfoldedPaneBackground"] as AcrylicBrush;

HyperlinkButtonArea.Background = themeDictionaries["NavigationViewUnfoldedPaneBackground"] as AcrylicBrush;
HyperlinkButton.Foreground = foregroundBrush;
};
}
Expand Down
Loading
Loading