Skip to content

Commit 5cde6a7

Browse files
committed
Theming tweaks
1 parent e6e8921 commit 5cde6a7

20 files changed

Lines changed: 463 additions & 783 deletions

FileDiff/AppSettings.cs

Lines changed: 271 additions & 279 deletions
Large diffs are not rendered by default.

FileDiff/ColorTheme.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public class ColorTheme
5353
// UI colors
5454
public required string NormalText { get; set; }
5555
public required string DisabledText { get; set; }
56+
public required string DisabledBackground { get; set; }
5657

5758
public required string WindowBackground { get; set; }
5859
public required string DialogBackground { get; set; }

FileDiff/DefaultSettings.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ public static class DefaultSettings
5656
NormalText = "#FFD8D8D8",
5757
DisabledText = "#FF888888",
5858

59+
DisabledBackground = "#FF444444",
60+
5961
WindowBackground = "#FF0B0B0B",
6062
DialogBackground = "#FF171717",
6163

@@ -120,6 +122,8 @@ public static class DefaultSettings
120122
NormalText = "#FF000000",
121123
DisabledText = "#FF888888",
122124

125+
DisabledBackground = "#FFAAAAAA",
126+
123127
WindowBackground = "#FFFFFFFF",
124128
DialogBackground = "#FFEBEBEB",
125129

FileDiff/DiffControl.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ public DiffControl()
6262

6363
#region Properties
6464

65-
private Selection _selection = null;
6665
private Selection Selection
6766
{
68-
get { return _selection; }
69-
set { _selection = value; ResetCursorBlink(); }
70-
}
67+
get;
68+
set { field = value; ResetCursorBlink(); }
69+
} = null;
7170

7271
private Point? _mouseDownPosition = null;
7372
private Point? MouseDownPosition
@@ -213,7 +212,7 @@ protected override void OnRender(DrawingContext drawingContext)
213212
break;
214213

215214
Line line = Lines[lineIndex];
216-
SolidColorBrush lineNumberColor = AppSettings.LineNumberColor;
215+
Brush lineNumberColor = AppSettings.LineNumberColor;
217216

218217
// Line Y offset
219218
drawingContext.PushTransform(new TranslateTransform(0, characterHeight * i));

FileDiff/DiffMapControl.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,13 @@ protected override void OnRender(DrawingContext drawingContext)
5151
double lineHeight = scrollableHeight / Lines.Count;
5252
double lastHeight = -1;
5353

54-
SolidColorBrush partialMatchBrush = BlendColors(AppSettings.PartialMatchBackground, AppSettings.PartialMatchForeground, .7);
54+
SolidColorBrush partialMatchBrush = BlendColors(AppSettings.PartialMatchBackground as SolidColorBrush , AppSettings.PartialMatchForeground as SolidColorBrush, .7);
5555

56-
SolidColorBrush deletedBrush = BlendColors(AppSettings.DeletedBackground, AppSettings.DeletedForeground, .7);
57-
SolidColorBrush movedFromBrush = BlendColors(AppSettings.MovedFromBackground, AppSettings.DeletedForeground, .7);
56+
SolidColorBrush deletedBrush = BlendColors(AppSettings.DeletedBackground as SolidColorBrush, AppSettings.DeletedForeground as SolidColorBrush, .7);
57+
SolidColorBrush movedFromBrush = BlendColors(AppSettings.MovedFromBackground as SolidColorBrush, AppSettings.DeletedForeground as SolidColorBrush, .7);
5858

59-
SolidColorBrush newBrush = BlendColors(AppSettings.NewBackground, AppSettings.NewForeground, .7);
60-
SolidColorBrush movedToBrush = BlendColors(AppSettings.MovedToBackground, AppSettings.NewForeground, .7);
59+
SolidColorBrush newBrush = BlendColors(AppSettings.NewBackground as SolidColorBrush, AppSettings.NewForeground as SolidColorBrush, .7);
60+
SolidColorBrush movedToBrush = BlendColors(AppSettings.MovedToBackground as SolidColorBrush, AppSettings.NewForeground as SolidColorBrush, .7);
6161

6262
SolidColorBrush lineBrush;
6363

FileDiff/FileDiff.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>WinExe</OutputType>
5-
<TargetFramework>net8.0-windows7.0</TargetFramework>
5+
<TargetFramework>net10.0-windows7.0</TargetFramework>
66
<UseWPF>true</UseWPF>
77
<ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
88
<ApplicationManifest>app.manifest</ApplicationManifest>

FileDiff/FileItem.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,29 +77,28 @@ public string Key
7777

7878
public TextState Type { get; set; }
7979

80-
private bool isExpanded;
8180
public bool IsExpanded
8281
{
83-
get { return this.isExpanded; }
82+
get;
8483
set
8584
{
86-
if (value != this.isExpanded)
85+
if (value != field)
8786
{
88-
this.isExpanded = value;
87+
field = value;
8988
CorrespondingItem.IsExpanded = value;
9089
}
9190
}
9291
}
9392

94-
public SolidColorBrush BackgroundBrush
93+
public Brush BackgroundBrush
9594
{
9695
get
9796
{
9897
return AppSettings.GetFolderBackground(Type);
9998
}
10099
}
101100

102-
public SolidColorBrush ForegroundBrush
101+
public Brush ForegroundBrush
103102
{
104103
get
105104
{

FileDiff/Line.cs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ public override int GetHashCode()
3838

3939
#region Properties
4040

41-
private string text = "";
4241
public string Text
4342
{
44-
get { return text; }
43+
get;
4544
set
4645
{
47-
text = value;
46+
field = value;
4847
TrimmedText = value.Trim();
4948
hash = value.GetHashCode();
5049

@@ -53,44 +52,46 @@ public string Text
5352
hashNoWhitespace = textNoWhitespace.GetHashCode();
5453
IsWhitespaceLine = textNoWhitespace == "";
5554

56-
characters = null;
57-
trimmedCharacters = null;
55+
Characters = null;
56+
TrimmedCharacters = null;
5857

5958
TextSegments.Clear();
6059
AddTextSegment(value, Type);
6160
}
62-
}
61+
} = "";
6362

6463
public string TrimmedText { get; private set; }
6564

6665
public ObservableCollection<TextSegment> TextSegments { get; private set; } = [];
6766

6867
public bool IsWhitespaceLine { get; private set; }
6968

70-
private List<char> characters;
7169
public List<char> Characters
7270
{
7371
get
7472
{
75-
if (characters == null)
73+
if (field == null)
7674
{
77-
characters = [.. text.ToCharArray()];
75+
field = [.. Text.ToCharArray()];
7876
}
79-
return characters;
77+
return field;
8078
}
79+
80+
private set;
8181
}
8282

83-
private List<char> trimmedCharacters;
8483
public List<char> TrimmedCharacters
8584
{
8685
get
8786
{
88-
if (trimmedCharacters == null)
87+
if (field == null)
8988
{
90-
trimmedCharacters = [.. TrimmedText.ToCharArray()];
89+
field = [.. TrimmedText.ToCharArray()];
9190
}
92-
return trimmedCharacters;
91+
return field;
9392
}
93+
94+
private set;
9495
}
9596

9697
public int? LineIndex { get; set; }
@@ -99,15 +100,14 @@ public List<char> TrimmedCharacters
99100

100101
public Dictionary<int?, float> MatchFactions { get; } = [];
101102

102-
private TextState type;
103103
public TextState Type
104104
{
105-
get { return type; }
105+
get;
106106
set
107107
{
108-
if (type != value)
108+
if (field != value)
109109
{
110-
type = value;
110+
field = value;
111111
TextSegments.Clear();
112112
AddTextSegment(Text, value);
113113
}
@@ -120,23 +120,23 @@ public bool IsFiller
120120
{
121121
get
122122
{
123-
return type == TextState.Filler || type == TextState.MovedFiller;
123+
return Type == TextState.Filler || Type == TextState.MovedFiller;
124124
}
125125
}
126126

127-
public SolidColorBrush BackgroundBrush
127+
public Brush BackgroundBrush
128128
{
129129
get
130130
{
131-
return AppSettings.GetFileBackground(type);
131+
return AppSettings.GetFileBackground(Type);
132132
}
133133
}
134134

135-
public SolidColorBrush ForegroundBrush
135+
public Brush ForegroundBrush
136136
{
137137
get
138138
{
139-
return AppSettings.GetFileForeground(type);
139+
return AppSettings.GetFileForeground(Type);
140140
}
141141
}
142142

FileDiff/Styles/Styles.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
</Style>
4242

4343
<Style x:Key="CommonGridSpliter" TargetType="GridSplitter">
44-
<Setter Property="BorderBrush" Value="{Binding Path=(local:AppSettings.BorderForeground), FallbackValue=#FFD6D6D6}" />
45-
<Setter Property="Background" Value="{Binding DialogBackground, FallbackValue=#FFF0F0F0}" />
44+
<Setter Property="BorderBrush" Value="{StaticResource Theme.BorderLight}" />
45+
<Setter Property="Background" Value="{StaticResource Theme.Dialog}" />
4646
</Style>
4747

4848
<Style TargetType="Label">

FileDiff/Templates/ThemedColors.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
<SolidColorBrush x:Key="Theme.NormalText" Color="{Binding Path=(local:AppSettings.WindowForegroundColor), FallbackValue=#FF000000}" />
88
<SolidColorBrush x:Key="Theme.DissabledText" Color="{Binding Path=(local:AppSettings.DisabledForegroundColor), FallbackValue=#FF888888}" />
99

10+
<SolidColorBrush x:Key="Theme.DissabledBackground" Color="{Binding Path=(local:AppSettings.DisabledBackgroundColor), FallbackValue=#FF888888}" />
11+
1012
<SolidColorBrush x:Key="Theme.Window" Color="{Binding Path=(local:AppSettings.WindowBackgroundColor), FallbackValue=#FFFFFFFF}" />
1113
<SolidColorBrush x:Key="Theme.Dialog" Color="{Binding Path=(local:AppSettings.DialogBackgroundColor), FallbackValue=#FFF0F0F0}" />
1214

0 commit comments

Comments
 (0)