Kind of CSS for Winforms.
- Selectors by Type, Name and class (using
Tag
). - Nested selectors.
- Supports all controls properties:
- Set via Reflection
- Set with Constructor
- Supports
KnownColors
andHtmlColors
- Supports Enum properties
- Variables block definition.
- Can include parent theme files.
- Simple registration by windows hook
Button { ... }
#button1 { .... }
this.button1.Tag = "Btn"; // <-- in the code
.Btn { ... }
Panel
{
Button { ... }
}
Button
{
BackColor : Red; // KnownColor
ForeColor : #67ffff; // HTML
Font: Arial, 20, Bold; // By font ctor
FlatAppearance.BorderSize: 2; // sub-property
}
$Variable
{
SomeColor: Blue;
}
Form
{
BackColor : @SomeColor;
}
$Include
{
parent1.theme;
parent2.theme;
}
// Program.cs
var theme = WinformsThemeLoader.Load("sample.theme");
using (ThemeHooker.HookTheme(theme))
{
Application.Run(new Form1());
}
See the Demo project for full working sample.
- Adapt to WPF and UWP
- Support events (such as OnEnter, OnLeave...)
- Apply selectors by order - by type -> by class -> by name;
- With hooking - make sure to handle controls that were created after the form has been shown.
- Tool for editing the theme file
- Setting images
- Set the cursor icon
- Convertor tool to CSS
Any contribution is welcome!
Theme format inspired by https://github.com/paradoxlost/ux