added foreground color for text in tooltip

This commit is contained in:
2026-08-09 00:29:05 +05:00
parent 253373d47e
commit 7c5675f69f
6 changed files with 56 additions and 19 deletions
+3
View File
@@ -59,6 +59,9 @@ public sealed partial class AppSettings : ObservableObject
[ObservableProperty]
private Color _backgroundColor = Color.FromRgb(0x20, 0x20, 0x20);
[ObservableProperty]
private Color _foregroundColor = Color.FromRgb(0xFF, 0xFF, 0xFF);
[JsonIgnore]
public TimeSpan Duration => TimeSpan.FromMilliseconds(DurationMilliseconds);
}
+3
View File
@@ -157,6 +157,9 @@
<data name="BackgroundColorLabel" xml:space="preserve">
<value>Background color</value>
</data>
<data name="TextColorLabel" xml:space="preserve">
<value>Text color</value>
</data>
<data name="SectionBehavior" xml:space="preserve">
<value>Behavior</value>
</data>
+3
View File
@@ -157,6 +157,9 @@
<data name="BackgroundColorLabel" xml:space="preserve">
<value>Цвет фона</value>
</data>
<data name="TextColorLabel" xml:space="preserve">
<value>Цвет текста</value>
</data>
<data name="SectionBehavior" xml:space="preserve">
<value>Поведение</value>
</data>
@@ -52,6 +52,18 @@ public sealed partial class SettingsViewModel : ObservableObject, IDisposable
Color.FromRgb(0xF5, 0xF5, 0xF5),
];
private static readonly Color[] ForegroundPalette =
[
Color.FromRgb(0xFF, 0xFF, 0xFF),
Color.FromRgb(0xD4, 0xD4, 0xD4),
Color.FromRgb(0x00, 0x00, 0x00),
Color.FromRgb(0xFA, 0xCC, 0x15),
Color.FromRgb(0x4A, 0xDE, 0x80),
Color.FromRgb(0x60, 0xA5, 0xFA),
Color.FromRgb(0xF9, 0x73, 0x16),
Color.FromRgb(0xF8, 0x71, 0x71),
];
public SettingsViewModel(AppSettings settings, ILocalizationService localization)
{
Settings = settings;
@@ -74,6 +86,8 @@ public sealed partial class SettingsViewModel : ObservableObject, IDisposable
public IReadOnlyList<Color> BackgroundPalette { get; } = Palette;
public IReadOnlyList<Color> TextPalette { get; } = ForegroundPalette;
public IReadOnlyList<EnumOption<AppTheme>> Themes { get; }
public IReadOnlyList<EnumOption<PopupPlacementMode>> PlacementModes { get; }
+6 -3
View File
@@ -21,9 +21,12 @@
<Border.Background>
<SolidColorBrush Color="{Binding Settings.BackgroundColor}" />
</Border.Background>
<TextBlock Foreground="White"
FontWeight="SemiBold"
<TextBlock FontWeight="SemiBold"
FontSize="{Binding Settings.FontSize}"
Text="{Binding ShortName}" />
Text="{Binding ShortName}">
<TextBlock.Foreground>
<SolidColorBrush Color="{Binding Settings.ForegroundColor}" />
</TextBlock.Foreground>
</TextBlock>
</Border>
</Window>
+27 -16
View File
@@ -21,6 +21,17 @@
<TextBlock Text="{Binding Display}" />
</DataTemplate>
<!-- Образец цвета с подписью: одинаково для фона и для текста -->
<DataTemplate x:Key="ColorSwatchTemplate">
<StackPanel Orientation="Horizontal">
<Border Width="32" Height="16" CornerRadius="2"
BorderBrush="#888" BorderThickness="1"
Background="{Binding Converter={StaticResource ColorToBrush}}" />
<TextBlock Margin="8,0,0,0"
Text="{Binding Converter={StaticResource ColorToHex}}" />
</StackPanel>
</DataTemplate>
<Style TargetType="TextBlock" x:Key="FieldLabel">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="0,0,12,0" />
@@ -211,6 +222,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Style="{StaticResource FieldLabel}"
@@ -235,24 +247,21 @@
Text="{Binding Localization[BackgroundColorLabel]}" />
<ComboBox Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,12,0,0"
ItemsSource="{Binding BackgroundPalette}"
SelectedItem="{Binding Settings.BackgroundColor}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Border Width="32" Height="16" CornerRadius="2"
BorderBrush="#888" BorderThickness="1"
Background="{Binding Converter={StaticResource ColorToBrush}}" />
<TextBlock Margin="8,0,0,0"
Text="{Binding Converter={StaticResource ColorToHex}}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
ItemTemplate="{StaticResource ColorSwatchTemplate}"
SelectedItem="{Binding Settings.BackgroundColor}" />
<TextBlock Grid.Row="3" Margin="0,12,12,0"
Style="{StaticResource FieldLabel}"
Text="{Binding Localization[TextColorLabel]}" />
<ComboBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,12,0,0"
ItemsSource="{Binding TextPalette}"
ItemTemplate="{StaticResource ColorSwatchTemplate}"
SelectedItem="{Binding Settings.ForegroundColor}" />
<TextBlock Grid.Row="4" Margin="0,12,12,0"
Style="{StaticResource FieldLabel}"
Text="{Binding Localization[PreviewLabel]}" />
<Border Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2"
<Border Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2"
Margin="0,12,0,0" Padding="16"
Background="{DynamicResource Theme.SurfaceStrong}" CornerRadius="4"
HorizontalAlignment="Stretch">
@@ -261,8 +270,10 @@
Opacity="{Binding Settings.Opacity}"
Background="{Binding Settings.BackgroundColor,
Converter={StaticResource ColorToBrush}}">
<TextBlock Text="RU" Foreground="White" FontWeight="SemiBold"
FontSize="{Binding Settings.FontSize}" />
<TextBlock Text="RU" FontWeight="SemiBold"
FontSize="{Binding Settings.FontSize}"
Foreground="{Binding Settings.ForegroundColor,
Converter={StaticResource ColorToBrush}}" />
</Border>
</Border>
</Grid>