Skip to content

Commit a40de0f

Browse files
committed
adding custom theme colors support (not enabled yet)
1 parent 80c15cd commit a40de0f

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

UnityLauncherPro/MainWindow.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@
714714
<Label Content="Root Folder for New Projects" Foreground="{DynamicResource ButtonForeground}" />
715715
</StackPanel>
716716
<StackPanel Grid.Row="3" Orientation="Horizontal">
717-
<TextBox x:Name="txtWebglRelativePath" MinWidth="200" ToolTip="Inside Builds/ folder you might have separate folder for webgl builds, like webgl/. User for starting WebGL server there" Padding="0,3,0,0" TextChanged="TxtWebglRelativePath_TextChanged" />
717+
<TextBox x:Name="txtWebglRelativePath" MinWidth="200" ToolTip="Inside Builds/ folder you might have separate folder for webgl builds, like webgl/. Used for starting WebGL server there" Padding="0,3,0,0" TextChanged="TxtWebglRelativePath_TextChanged" />
718718
<Label Content="Webgl Relative Build Path (inside Builds/)" Foreground="{DynamicResource ButtonForeground}" />
719719
</StackPanel>
720720
</StackPanel>

UnityLauncherPro/MainWindow.xaml.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
using System.Windows.Controls;
1616
using System.Windows.Data;
1717
using System.Windows.Input;
18+
using System.Windows.Media;
1819
using System.Windows.Shell;
1920

2021
namespace UnityLauncherPro
@@ -56,6 +57,9 @@ public MainWindow()
5657
void Start()
5758
{
5859
LoadSettings();
60+
61+
// TEST
62+
//ApplySkin();
5963

6064
// disable accesskeys without alt
6165
CoreCompatibilityPreferences.IsAltKeyRequiredInAccessKeyDefaultScope = true;
@@ -1714,6 +1718,35 @@ private void MenuItemBrowsePersistentDataPath_Click(object sender, RoutedEventAr
17141718
break;
17151719
}
17161720
}
1721+
1722+
void ApplySkin()
1723+
{
1724+
// TODO dont load, if skinning is disabled in settings
1725+
// TODO load current skin (or could save them into preferences from settings panel, so that it doesnt need to parse file everytime! and have reset colors button to reset them)
1726+
// TODO set colors to resources
1727+
1728+
// TEST
1729+
var themefile = "theme.ini";
1730+
1731+
if (File.Exists(themefile))
1732+
{
1733+
var colors = File.ReadAllLines(themefile);
1734+
1735+
// parse lines
1736+
for (int i = 0, length = colors.Length; i < length; i++)
1737+
{
1738+
// skip comments
1739+
if (colors[i].IndexOf('#') == 0) continue;
1740+
// split row (name and color)
1741+
var row = colors[i].Split('=');
1742+
// skip bad rows
1743+
if (row.Length != 2) continue;
1744+
// apply color
1745+
Application.Current.Resources[row[0]] = (SolidColorBrush)(new BrushConverter().ConvertFrom(row[1]));
1746+
}
1747+
}
1748+
} // loadskin()
1749+
17171750
} // class
17181751
} //namespace
17191752

0 commit comments

Comments
 (0)