Skip to content

Commit f9f57d8

Browse files
committed
Fixes and changes
* Fix ColourJsonConverter not writing correctly * Added colouring for tooltips * Fixed hacky code for theme editor not working (As Colour Picker lib now allows you to hide what we hiding. Still need to do some edits in order to move the controls in a way that we like)
1 parent f629344 commit f9f57d8

File tree

3 files changed

+25
-34
lines changed

3 files changed

+25
-34
lines changed

src/MultiRPC/Converters/ColourJsonConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ public override Color Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSe
2121

2222
public override void Write(Utf8JsonWriter writer, Color value, JsonSerializerOptions options)
2323
{
24-
writer.WriteStringValue("#" + value.ToUint32().ToString(":x8"));
24+
writer.WriteStringValue("#" + value.ToUint32().ToString("x8"));
2525
}
2626
}

src/MultiRPC/Theming/Theme.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ public void Apply(IResourceDictionary? resourceDictionary = null, bool fireAsset
314314
resourceDictionary.UpdateIfDifferent("CheckBoxCheckBackgroundStrokeCheckedPressed", color5Brush);
315315
resourceDictionary.UpdateIfDifferent("CheckBoxCheckBackgroundStrokeUncheckedPressed", color5Brush);
316316

317+
resourceDictionary.UpdateIfDifferent("ToolTipForeground", resourceDictionary["ThemeForegroundBrush"]);
318+
resourceDictionary.UpdateIfDifferent("ToolTipBackground", resourceDictionary["ThemeAccentBrush"]);
319+
resourceDictionary.UpdateIfDifferent("ToolTipBorderBrush", resourceDictionary["ThemeAccentBrush4"]);
317320
if (fireAssetChange)
318321
{
319322
AssetManager.FireReloadAssets(this);

src/MultiRPC/UI/Pages/Theme/ThemeEditorPage.axaml.cs

Lines changed: 21 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -77,53 +77,41 @@ public void EditTheme(Theming.Theme theme)
7777
while they are cool... there'll also be very confusing to the average user*/
7878
private void ProcessColourPicker()
7979
{
80-
clpPicker.FindControl<ComboBox>("ColorSpaceComboBox").SelectedIndex = 1;
81-
clpPicker.FindControl<IControl>("PaletteSelector").IsVisible = false;
82-
8380
var grid = (Grid)((Grid)clpPicker.Content).Children[0];
84-
grid.Children[2].IsVisible = false;
85-
grid.Children[6].IsVisible = false;
86-
87-
var zeroL = GridLength.Parse("0");
88-
grid.ColumnDefinitions[3].Width = GridLength.Auto;
89-
grid.ColumnDefinitions[4].Width = zeroL;
90-
grid.ColumnDefinitions[^1].Width = GridLength.Auto;
91-
grid.ColumnDefinitions[^2].Width = zeroL;
92-
93-
var hsvControls = ((Grid)grid.Children[4]).Children;
94-
for (int i = 7; i < hsvControls.Count; i++)
95-
{
96-
hsvControls[i].IsVisible = false;
97-
}
9881
var clabControls = ((Grid)grid.Children[5]).Children;
99-
for (int i = 0; i < 10; i++)
100-
{
101-
clabControls[i].IsVisible = false;
102-
}
103-
104-
/*Move the hex controls to the next grid controls,
105-
we're have more space that way*/
106-
var hexHeader = (Control)clabControls[10];
107-
Grid.SetRow(hexHeader, 4);
108-
clabControls.RemoveAt(10);
82+
var hexTextBox = clpPicker.Find<TextBox>("Hex_Box");
83+
84+
Grid.SetRow(hexTextBox, 5);
85+
clabControls.Remove(hexTextBox);
10986

11087
var hexHashText = (Control)clabControls[10];
11188
Grid.SetRow(hexHashText, 5);
112-
clabControls.RemoveAt(10);
113-
114-
var hexTextBox = (TextBox)clabControls[10];
115-
Grid.SetRow(hexTextBox, 5);
116-
clabControls.RemoveAt(10);
89+
clabControls.Remove(hexHashText);
90+
91+
var hexHeader = (Control)clabControls[10];
92+
Grid.SetRow(hexHeader, 4);
93+
clabControls.Remove(hexHeader);
11794

95+
var hsvControls = ((Grid)grid.Children[4]).Children;
11896
hsvControls.Add(hexHeader);
11997
hsvControls.Add(hexHashText);
12098
hsvControls.Add(hexTextBox);
121-
99+
122100
hexTextBox.GetObservable(TextBox.TextProperty).Subscribe(x =>
123101
{
124102
_colourButton.BtnColor = new ImmutableSolidColorBrush(clpPicker.Color);
125103
UpdateTheme(_colourButton.Name, clpPicker.Color);
126104
});
105+
106+
clpPicker.IsPaletteVisible = false;
107+
clpPicker.IsHSBVisible = false;
108+
clpPicker.IsAlphaVisible = false;
109+
clpPicker.IsColourBlindnessSelectorVisible = false;
110+
clpPicker.IsCIELABVisible = false;
111+
112+
var zeroL = GridLength.Parse("0");
113+
grid.ColumnDefinitions[^1].Width = GridLength.Auto;
114+
grid.ColumnDefinitions[^2].Width = zeroL;
127115
}
128116

129117
private void UpdateTheme(string name, Color color)

0 commit comments

Comments
 (0)