Skip to content

Commit 72f7e5b

Browse files
authored
Merge pull request #960 from adnan-bhaldar/ui/color-picker-card-pastel-columns-toggle-hover
feat(ui): color picker card, pastel preset columns and Material You toggle hover
2 parents 6f048de + 31ae53e commit 72f7e5b

3 files changed

Lines changed: 49 additions & 3 deletions

File tree

‎src/Filee.App/App.axaml‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
<!-- The Theme page's colour picker shows only the spectrum: no empty tab strip above it. Set here because its
2020
flyout looks resources up outside the page. -->
2121
<x:Double x:Key="ColorViewTabStripHeight">0</x:Double>
22+
<!-- The picker's own panels draw their background and borders from these: clear, so the card (the
23+
FlyoutPresenter.nopadding style below) is the only surface and no stray lines show. -->
24+
<SolidColorBrush x:Key="ColorViewContentBackgroundBrush" Color="Transparent" />
25+
<SolidColorBrush x:Key="ColorViewContentBorderBrush" Color="Transparent" />
26+
<SolidColorBrush x:Key="ColorViewTabBorderBrush" Color="Transparent" />
2227
</ResourceDictionary>
2328
</Application.Resources>
2429

@@ -36,6 +41,34 @@
3641
<Style Selector="FlyoutPresenter.nopadding Border#ContentBackgroundBorder">
3742
<Setter Property="Margin" Value="0" />
3843
</Style>
44+
<!-- The tab strip is hidden, but its selected tab still drew an accent line along the top of the card. -->
45+
<Style Selector="FlyoutPresenter.nopadding TabItem /template/ Border#PART_SelectedPipe">
46+
<Setter Property="IsVisible" Value="False" />
47+
</Style>
48+
<Style Selector="FlyoutPresenter.nopadding TabItem:selected /template/ Border#PART_SelectedPipe">
49+
<Setter Property="IsVisible" Value="False" />
50+
</Style>
51+
<!-- The picker's card: the page's surface with the theme's soft corners and a faint outline. -->
52+
<Style Selector="FlyoutPresenter.nopadding">
53+
<Setter Property="Background" Value="{DynamicResource SurfaceBrush}" />
54+
<Setter Property="BorderBrush" Value="{DynamicResource SubtleBorderBrush}" />
55+
<Setter Property="BorderThickness" Value="1" />
56+
<Setter Property="CornerRadius" Value="{DynamicResource SoftRadius}" />
57+
</Style>
58+
<!-- The spectrum square follows the theme's softness too. -->
59+
<Style Selector="FlyoutPresenter.nopadding ColorSpectrum">
60+
<Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusSmall}" />
61+
</Style>
62+
<!-- The swatch button on the pages: soft corners, a quiet outline, and a card colour around the swatch so a white
63+
one still shows. -->
64+
<Style Selector="ColorPicker">
65+
<Setter Property="CornerRadius" Value="{DynamicResource SoftRadiusSmall}" />
66+
</Style>
67+
<Style Selector="ColorPicker /template/ DropDownButton">
68+
<Setter Property="Background" Value="{DynamicResource SurfaceAltBrush}" />
69+
<Setter Property="BorderBrush" Value="{DynamicResource SubtleBorderBrush}" />
70+
<Setter Property="BorderThickness" Value="1.5" />
71+
</Style>
3972
<StyleInclude Source="avares://Filee/Styles/Soft.axaml" />
4073
<StyleInclude Source="avares://Filee/Styles/Controls.axaml" />
4174
<StyleInclude Source="avares://Filee/Styles/TagEditor.axaml" />

‎src/Filee.App/Styles/Soft.axaml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,9 +455,11 @@
455455
<Setter Property="Background" Value="{DynamicResource AccentBrush}" />
456456
<Setter Property="BorderBrush" Value="{DynamicResource AccentBrush}" />
457457
</Style>
458+
<!-- On + hover: the same accent as the Save button's hover (the accent, a little darker), not AccentStrong, which is
459+
the dark navy / pale lavender "on container" colour of the palette. -->
458460
<Style Selector="Window.material-you ToggleSwitch:checked:pointerover /template/ Border#SwitchKnobBounds">
459-
<Setter Property="Background" Value="{DynamicResource AccentStrongBrush}" />
460-
<Setter Property="BorderBrush" Value="{DynamicResource AccentStrongBrush}" />
461+
<Setter Property="Background" Value="{DynamicResource AccentButtonBackgroundPointerOver}" />
462+
<Setter Property="BorderBrush" Value="{DynamicResource AccentButtonBackgroundPointerOver}" />
461463
</Style>
462464
<Style Selector="Window.material-you ToggleSwitch:checked /template/ Ellipse#SwitchKnob">
463465
<Setter Property="Fill" Value="{DynamicResource OnAccentBrush}" />

‎src/Filee.App/Views/Pages/ThemePage.axaml‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
11
<UserControl xmlns="https://github.com/avaloniaui"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:vm="using:Filee.App.ViewModels.Pages"
4+
xmlns:vmw="using:Filee.App.ViewModels"
45
xmlns:c="using:Filee.App.Controls"
56
xmlns:settings="using:Filee.Core.Settings"
67
x:Class="Filee.App.Views.Pages.ThemePage"
78
x:DataType="vm:ThemePageViewModel">
89
<UserControl.Styles>
10+
<!-- Pastel presets: 2 columns, 3 with the navigation collapsed (see the grid below). -->
11+
<Style Selector="UniformGrid.presets">
12+
<Setter Property="Columns" Value="2" />
13+
</Style>
14+
<Style Selector="UniformGrid.presets.wide">
15+
<Setter Property="Columns" Value="3" />
16+
</Style>
917
<Style Selector="Button.choice-card">
1018
<Setter Property="CornerRadius" Value="{DynamicResource SoftRadius}" />
1119
<Setter Property="Padding" Value="14,10" />
@@ -205,7 +213,10 @@
205213
<ItemsControl ItemsSource="{Binding PastelPresets}">
206214
<ItemsControl.ItemsPanel>
207215
<ItemsPanelTemplate>
208-
<UniformGrid Columns="2" />
216+
<!-- Two columns; three while the navigation is collapsed to icons (the page is wider then). The
217+
"wide" class follows the main window's collapsed state, and the styles above set the columns. -->
218+
<UniformGrid Classes="presets"
219+
Classes.wide="{Binding $parent[Window].((vmw:MainWindowViewModel)DataContext).IsNavCollapsed}" />
209220
</ItemsPanelTemplate>
210221
</ItemsControl.ItemsPanel>
211222
<ItemsControl.ItemTemplate>

0 commit comments

Comments
 (0)