Giter VIP home page Giter VIP logo

winformstheme's Introduction

WinformsTheme

Kind of CSS for Winforms.

Features

  • Selectors by Type, Name and class (using Tag).
  • Nested selectors.
  • Supports all controls properties:
    • Set via Reflection
    • Set with Constructor
    • Supports KnownColors and HtmlColors
    • Supports Enum properties
  • Variables block definition.
  • Can include parent theme files.
  • Simple registration by windows hook

Selector by type

Button { ... }

Selector by name

#button1 { .... }

Selector by class

this.button1.Tag = "Btn"; // <-- in the code

.Btn { ... }

Nested selectors

Panel
{
    Button { ... }
}

Properties

Button 
{
    BackColor : Red; // KnownColor
    ForeColor : #67ffff; // HTML
    Font: Arial, 20, Bold; // By font ctor
    FlatAppearance.BorderSize: 2; // sub-property
}

Variable block

$Variable
{
    SomeColor: Blue;
}

Form 
{
    BackColor : @SomeColor;
}

Include block

$Include 
{
    parent1.theme;
    parent2.theme;
}

Registration

// Program.cs
var theme = WinformsThemeLoader.Load("sample.theme");
using (ThemeHooker.HookTheme(theme))
{
    Application.Run(new Form1());
}

See the Demo project for full working sample.

Todo & Ideas

  • 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.