浏览代码

Add option for opacity of the text

similar to existing one for background

Part of #67
Daniel Chalmers 9 月之前
父节点
当前提交
8bd27f9556
共有 3 个文件被更改,包括 18 次插入1 次删除
  1. 2 1
      DesktopClock/MainWindow.xaml
  2. 5 0
      DesktopClock/Properties/Settings.cs
  3. 11 0
      DesktopClock/SettingsWindow.xaml

+ 2 - 1
DesktopClock/MainWindow.xaml

@@ -149,7 +149,8 @@
                                      TextWrapping="Wrap">
 
                 <local:OutlinedTextBlock.Fill>
-                    <SolidColorBrush Color="{Binding TextColor, Source={x:Static p:Settings.Default}, Mode=OneWay}" />
+                    <SolidColorBrush Opacity="{Binding TextOpacity, Source={x:Static p:Settings.Default}, Mode=OneWay}"
+                                     Color="{Binding TextColor, Source={x:Static p:Settings.Default}, Mode=OneWay}" />
                 </local:OutlinedTextBlock.Fill>
 
                 <local:OutlinedTextBlock.Style>

+ 5 - 0
DesktopClock/Properties/Settings.cs

@@ -117,6 +117,11 @@ public sealed class Settings : INotifyPropertyChanged, IDisposable
     /// </summary>
     public Color TextColor { get; set; }
 
+    /// <summary>
+    /// Opacity of the text.
+    /// </summary>
+    public double TextOpacity { get; set; } = 1;
+
     /// <summary>
     /// The outer color, for either the background or the outline.
     /// </summary>

+ 11 - 0
DesktopClock/SettingsWindow.xaml

@@ -122,6 +122,17 @@
                            FontSize="10"
                            Margin="0,0,0,12" />
 
+                <TextBlock Text="Text Opacity:" />
+                <Slider Value="{Binding Settings.TextOpacity, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                        Minimum="0"
+                        Maximum="1"
+                        TickFrequency="0.01"
+                        IsSnapToTickEnabled="True" />
+                <TextBlock Text="Opacity of the clock's text."
+                           FontStyle="Italic"
+                           FontSize="10"
+                           Margin="0,0,0,12" />
+
                 <TextBlock Text="Outer Color:" />
                 <TextBox Text="{Binding Settings.OuterColor, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                 <TextBlock Text="The outer color, for either the background or the outline."