Rework themes settings

This commit is contained in:
Felix Seidl
2020-02-29 15:30:46 +01:00
parent 5ae7151916
commit ae6e61d6fa
26 changed files with 360 additions and 76 deletions
+16 -14
View File
@@ -1,11 +1,13 @@
using FluentTerminal.App.Services;
using FluentTerminal.App.Services.Utilities;
using FluentTerminal.App.ViewModels.Infrastructure;
using FluentTerminal.Models;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Newtonsoft.Json;
using System;
using System.Threading.Tasks;
using System.Windows.Input;
namespace FluentTerminal.App.ViewModels
{
@@ -93,13 +95,13 @@ namespace FluentTerminal.App.ViewModels
BackgroundThemeFile = Model.BackgroundImage;
SetActiveCommand = new RelayCommand(SetActive);
DeleteCommand = new RelayCommand(async () => await DeleteAsync().ConfigureAwait(false), NotPreInstalled);
DeleteCommand = new AsyncCommand(DeleteAsync, NotPreInstalled);
EditCommand = new RelayCommand(Edit, NotPreInstalled);
CancelEditCommand = new RelayCommand(async () => await CancelEditAsync().ConfigureAwait(false));
SaveChangesCommand = new RelayCommand(async () => await SaveChangesAsync().ConfigureAwait(false));
ExportCommand = new RelayCommand(async () => await Export().ConfigureAwait(false), NotPreInstalled);
ChooseBackgroundImageCommand = new RelayCommand(async () => await ChooseBackgroundImageAsync(), NotPreInstalled);
DeleteBackgroundImageCommand = new RelayCommand(async () => await DeleteBackgroundImageAsync(), NotPreInstalled);
CancelEditCommand = new AsyncCommand(CancelEditAsync);
SaveChangesCommand = new AsyncCommand(SaveChangesAsync);
ExportCommand = new AsyncCommand(Export, NotPreInstalled);
ChooseBackgroundImageCommand = new AsyncCommand(ChooseBackgroundImageAsync, NotPreInstalled);
DeleteBackgroundImageCommand = new AsyncCommand(DeleteBackgroundImageAsync, NotPreInstalled);
}
public event EventHandler Activated;
@@ -190,7 +192,7 @@ namespace FluentTerminal.App.ViewModels
set => Set(ref _brightYellow, value);
}
public RelayCommand CancelEditCommand { get; }
public ICommand CancelEditCommand { get; }
public string Cursor
{
@@ -210,9 +212,9 @@ namespace FluentTerminal.App.ViewModels
set => Set(ref _cyan, value);
}
public RelayCommand DeleteCommand { get; }
public RelayCommand EditCommand { get; }
public RelayCommand ExportCommand { get; }
public ICommand DeleteCommand { get; }
public ICommand EditCommand { get; }
public ICommand ExportCommand { get; }
public string Foreground
{
@@ -258,7 +260,7 @@ namespace FluentTerminal.App.ViewModels
set => Set(ref _red, value);
}
public RelayCommand SaveChangesCommand { get; }
public ICommand SaveChangesCommand { get; }
public string Selection
{
@@ -266,7 +268,7 @@ namespace FluentTerminal.App.ViewModels
set => Set(ref _selection, value);
}
public RelayCommand SetActiveCommand { get; }
public ICommand SetActiveCommand { get; }
public string White
{
@@ -290,9 +292,9 @@ namespace FluentTerminal.App.ViewModels
}
}
public RelayCommand ChooseBackgroundImageCommand { get; }
public ICommand ChooseBackgroundImageCommand { get; }
public RelayCommand DeleteBackgroundImageCommand { get; }
public ICommand DeleteBackgroundImageCommand { get; }
// Requires UI thread
private async Task SaveChangesAsync()
+1
View File
@@ -41,6 +41,7 @@
<converters:ColorResourceKeyFallbackConverter x:Key="ColorResourceKeyFallbackConverter" />
<converters:TrueToBoldConverter x:Key="TrueToBoldConverter" />
<converters:I18NConverter x:Key="I18NConverter" />
<converters:NullToCollapsedConverter x:Key="NullToCollapsedConverter" />
</ResourceDictionary>
</Application.Resources>
</Application>
@@ -0,0 +1,19 @@
using System;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;
namespace FluentTerminal.App.Converters
{
public class NullToCollapsedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return value == null ? Visibility.Collapsed : Visibility.Visible;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
throw new NotImplementedException();
}
}
}
@@ -114,6 +114,7 @@
<Compile Include="Converters\I18NConverter.cs" />
<Compile Include="Converters\IconConverter.cs" />
<Compile Include="Converters\MenuItemViewModelBaseToMenuFlayoutItemBaseConverter.cs" />
<Compile Include="Converters\NullToCollapsedConverter.cs" />
<Compile Include="Converters\TabColorFallbackConverter.cs" />
<Compile Include="Converters\EnumValueToVisibiltyConverter.cs" />
<Compile Include="Converters\FalseToVisibleConverter.cs" />
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1064,4 +1064,17 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Hintergrundbild</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Hintergrund mit Acryl-Effekt</value>
<comment>Fuzzy</comment>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Sind Sie sicher dass Sie dieses Hintergrundbild löschen möchten?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Farben</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Helle Farben</value>
</data>
</root>
@@ -1098,4 +1098,17 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
<comment>Fuzzy</comment>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1053,4 +1053,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1096,4 +1096,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1041,4 +1041,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1044,4 +1044,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1041,4 +1041,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1098,4 +1098,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1033,4 +1033,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1033,4 +1033,16 @@ Fuzzy</comment>
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1033,4 +1033,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -1032,4 +1032,16 @@
<data name="BackgroundImage.Content" xml:space="preserve">
<value>Background image</value>
</data>
<data name="AcrylicBackground.Header" xml:space="preserve">
<value>Use acrylic background</value>
</data>
<data name="ConfirmDeleteBackgroundImage" xml:space="preserve">
<value>Are you sure you want to delete this background image?</value>
</data>
<data name="Colors.Text" xml:space="preserve">
<value>Colors</value>
</data>
<data name="BrightColors.Text" xml:space="preserve">
<value>Bright colors</value>
</data>
</root>
@@ -140,7 +140,7 @@ namespace FluentTerminal.App.Views
private void Page_Loaded(object sender, RoutedEventArgs e)
{
ApplicationView.GetForCurrentView().TryResizeView(new Size { Width = 800, Height = 600 });
ApplicationView.GetForCurrentView().TryResizeView(new Size { Width = 1024, Height = 768 });
}
}
}
@@ -9,7 +9,7 @@
mc:Ignorable="d">
<Grid x:Name="Root">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
@@ -21,13 +21,14 @@
<Border
Grid.RowSpan="3"
Grid.Column="0"
Background="{ThemeResource SystemControlAcrylicWindowBrush}" />
<Grid Grid.Row="1"
Grid.ColumnSpan="2"
Margin="{StaticResource HeaderMargin}"
RequestedTheme="{x:Bind ViewModel.SelectedTheme.Background, Mode=OneWay, Converter={StaticResource BackgroundToApplicationThemeConverter}}">
Background="{ThemeResource SystemControlChromeMediumAcrylicElementMediumBrush}" />
<Grid
Grid.Row="1"
Grid.ColumnSpan="2"
Margin="{StaticResource HeaderMargin}"
RequestedTheme="{x:Bind ViewModel.SelectedTheme.Background, Mode=OneWay, Converter={StaticResource BackgroundToApplicationThemeConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="160" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
@@ -46,7 +47,7 @@
Visibility="{x:Bind ViewModel.SelectedTheme.InEditMode, Mode=OneWay, Converter={StaticResource FalseToVisibleConverter}}">
<AppBarButton
Name="SetActiveButton"
x:Uid="SetActiveAppBarButton"
x:Uid="SetDefaultAppBarButton"
Command="{x:Bind ViewModel.SelectedTheme.SetActiveCommand, Mode=OneWay}"
Icon="Accept"
IsEnabled="{Binding ViewModel.SelectedTheme.IsActive, Mode=OneWay, Converter={StaticResource NegateConverter}}"
@@ -180,12 +181,12 @@
</Button>
</StackPanel>
</ScrollViewer>
<ContentControl
Grid.Row="2"
Grid.Column="1"
Margin="0,10"
HorizontalContentAlignment="Stretch"
Margin="0 10"
Content="{x:Bind ViewModel.SelectedTheme, Mode=TwoWay}"
RequestedTheme="{x:Bind ViewModel.SelectedTheme.Background, Mode=OneWay, Converter={StaticResource BackgroundToApplicationThemeConverter}}">
<ContentControl.ContentTemplate>
@@ -204,7 +205,6 @@
</TextBlock>
<TextBlock
Margin="{StaticResource ItemMargin}"
FontSize="14"
Style="{StaticResource SubtitleTextBlockStyle}"
Text="{x:Bind Author, Mode=OneWay}"
@@ -255,13 +255,15 @@
<TextBlock
x:Uid="ClickColorEdit"
Grid.Row="1"
Margin="0,0,0,8"
FontSize="14"
FontStyle="Italic"
Foreground="LightGray"
Text="Click on a color to edit"
Visibility="{x:Bind InEditMode, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}" />
<StackPanel Grid.Row="2" Orientation="Horizontal">
<StackPanel
Grid.Row="2"
Margin="0,6,0,0"
Orientation="Horizontal">
<views:TerminalColorPicker
ColorName="Black"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
@@ -294,8 +296,16 @@
ColorName="White"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
SelectedColor="{x:Bind White, Mode=TwoWay}" />
<TextBlock
x:Uid="Colors"
Margin="6,0,0,0"
VerticalAlignment="Center"
Text="Colors" />
</StackPanel>
<StackPanel Grid.Row="3" Orientation="Horizontal">
<StackPanel
Grid.Row="3"
Margin="{StaticResource ItemMargin}"
Orientation="Horizontal">
<views:TerminalColorPicker
ColorName="Bright Black"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
@@ -328,53 +338,67 @@
ColorName="Bright White"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
SelectedColor="{x:Bind BrightWhite, Mode=TwoWay}" />
<TextBlock
x:Uid="BrightColors"
Margin="6,0,0,0"
VerticalAlignment="Center"
Text="Bright colors" />
</StackPanel>
<StackPanel Grid.Row="4" Orientation="Horizontal">
<StackPanel Grid.Row="4">
<views:TerminalColorPicker
Margin="{StaticResource ItemMargin}"
ColorName="Foreground"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
SelectedColor="{x:Bind Foreground, Mode=TwoWay}" />
SelectedColor="{x:Bind Foreground, Mode=TwoWay}"
ShowName="True" />
<views:TerminalColorPicker
Margin="{StaticResource ItemMargin}"
ColorName="Background"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
SelectedColor="{x:Bind Background, Mode=TwoWay}" />
SelectedColor="{x:Bind Background, Mode=TwoWay}"
ShowName="True" />
<views:TerminalColorPicker
Margin="{StaticResource ItemMargin}"
ColorName="Cursor"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
SelectedColor="{x:Bind Cursor, Mode=TwoWay}" />
SelectedColor="{x:Bind Cursor, Mode=TwoWay}"
ShowName="True" />
<views:TerminalColorPicker
Margin="{StaticResource ItemMargin}"
ColorName="Cursor Accent"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
SelectedColor="{x:Bind CursorAccent, Mode=TwoWay}" />
SelectedColor="{x:Bind CursorAccent, Mode=TwoWay}"
ShowName="True" />
<views:TerminalColorPicker
Margin="{StaticResource ItemMargin}"
ColorName="Selection"
EnableEditing="{x:Bind InEditMode, Mode=OneWay}"
IsAlphaEnabled="True"
SelectedColor="{x:Bind Selection, Mode=TwoWay}" />
SelectedColor="{x:Bind Selection, Mode=TwoWay}"
ShowName="True" />
</StackPanel>
</Grid>
<Grid Margin="{StaticResource ItemMargin}"
Visibility="{x:Bind InEditMode, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel
Margin="{StaticResource ItemMargin}"
Orientation="Horizontal"
Visibility="{x:Bind InEditMode, Mode=OneWay, Converter={StaticResource TrueToVisibleConverter}}">
<TextBlock
Margin="0,0,6,0"
VerticalAlignment="Center"
Text="{x:Bind Converter={StaticResource I18NConverter}, ConverterParameter=BackgroundImage.Content}" />
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Converter={StaticResource I18NConverter}, ConverterParameter=BackgroundImage.Content}" />
<Button
Margin="0,0,6,0"
Command="{x:Bind ChooseBackgroundImageCommand}"
Content="{x:Bind Converter={StaticResource I18NConverter}, ConverterParameter=BrowseButton.Content}" />
<Button Grid.Column="1"
Content="{x:Bind Converter={StaticResource I18NConverter}, ConverterParameter=BrowseButton.Content}"
Command="{x:Bind ChooseBackgroundImageCommand}" />
<Button Grid.Column="2"
Content="X"
Margin="10 0 0 0"
Command="{x:Bind DeleteBackgroundImageCommand}" />
</Grid>
<HyperlinkButton
x:Uid="ResetBtn"
Command="{x:Bind DeleteBackgroundImageCommand}"
Content="Reset"
Visibility="{x:Bind BackgroundThemeFile, Converter={StaticResource NullToCollapsedConverter}, Mode=OneWay}" />
</StackPanel>
</StackPanel>
</ScrollViewer>
</DataTemplate>
@@ -5,29 +5,39 @@
xmlns:controls="using:Microsoft.UI.Xaml.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Margin="0,0,6,0"
d:DesignHeight="24"
d:DesignWidth="24"
mc:Ignorable="d">
<Button
x:Name="Root"
Background="{x:Bind ButtonBackground, Mode=OneWay}"
IsEnabled="{x:Bind EnableEditing, Mode=OneWay}"
Style="{StaticResource ColorPreviewButtonStyle}"
ToolTipService.ToolTip="{x:Bind ColorName}">
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock
Margin="0,0,0,6"
Style="{StaticResource TitleTextBlockStyle}"
Text="{x:Bind ColorName}" />
<controls:ColorPicker
x:Name="colorPicker"
ColorChanged="ColorPicker_ColorChanged"
IsAlphaEnabled="{x:Bind IsAlphaEnabled, Mode=OneWay}"
IsColorChannelTextInputVisible="False" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<StackPanel Orientation="Horizontal" ToolTipService.ToolTip="{x:Bind ColorName}">
<Button
x:Name="Root"
Width="24"
Height="24"
Background="{x:Bind ButtonBackground, Mode=OneWay}"
IsEnabled="{x:Bind EnableEditing, Mode=OneWay}"
Style="{StaticResource ColorPreviewButtonStyle}">
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock
Margin="0,0,0,6"
Style="{StaticResource TitleTextBlockStyle}"
Text="{x:Bind ColorName}" />
<controls:ColorPicker
x:Name="colorPicker"
ColorChanged="ColorPicker_ColorChanged"
IsAlphaEnabled="{x:Bind IsAlphaEnabled, Mode=OneWay}"
IsColorChannelTextInputVisible="False" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
<TextBlock
Margin="6,0,0,0"
VerticalAlignment="Center"
Text="{x:Bind ColorName}"
Visibility="{x:Bind ShowName, Converter={StaticResource TrueToVisibleConverter}}" />
</StackPanel>
</UserControl>
@@ -16,6 +16,9 @@ namespace FluentTerminal.App.Views
public static readonly DependencyProperty EnableEditingProperty =
DependencyProperty.Register(nameof(EnableEditing), typeof(bool), typeof(TerminalColorPicker), new PropertyMetadata(false));
public static readonly DependencyProperty ShowNameProperty =
DependencyProperty.Register(nameof(ShowName), typeof(bool), typeof(TerminalColorPicker), new PropertyMetadata(false));
public static readonly DependencyProperty IsAlphaEnabledProperty =
DependencyProperty.Register(nameof(IsAlphaEnabled), typeof(bool), typeof(TerminalColorPicker), new PropertyMetadata(false));
@@ -54,6 +57,12 @@ namespace FluentTerminal.App.Views
set { SetValue(EnableEditingProperty, value); }
}
public bool ShowName
{
get { return (bool)GetValue(ShowNameProperty); }
set { SetValue(ShowNameProperty, value); }
}
public bool IsAlphaEnabled
{
get { return (bool)GetValue(IsAlphaEnabledProperty); }