Skip to content

Adds an easy(ish) way to use themes in C# Winfows Forms with .net

License

Notifications You must be signed in to change notification settings

anarchie347/Themes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Themes

About

A library for easily(ish) created themes in Windows Forms .NET to allow you to easily change colours of lots of controls

This package requires .NET 6, and can only be used on Windows version 7 or greater

Usage: Github wiki

Getting started:

Replace

internal partial class Form1 : Form

With

internal partial class Form1 : ThemeableForm<Theme>

Theme is the implementation of the Theme class used for this form. If you want to define your own schema for a theme, put that class inside the <>. You can see how to create a new schema here

ThemeableButton myButton = new();
myButton.ThemeBackColor = () => CurrentTheme.PrimaryColor;
myButton.ThemeForeColor = () => CurrentTheme.SecondaryColor;
myButton.ThemeImage = () => CurrentTheme.someImage;

myButton.Click += (sender, e) =>
{
    if (CurrentTheme == Themes.Dark)
        CurrentTheme = Themes.Light;
    else
        CurrentTheme = Themes.Dark;
};
this.Controls.Add(myButton);

Creates a ThemeableButton that swaps the theme between light and dark. When the Theme changes, the colours and image of the button will also update. This code is inside the Form1 class.

Themes is a class defined by the project using the Themes library, which contains instances of the Theme used for this form

Contributing

Created by anarchie347

Issue tracker: Github issue tracker

Contribute on Github

Credits

Icon: Photo by RhondaK Native Florida Folk Artist on Unsplash

About

Adds an easy(ish) way to use themes in C# Winfows Forms with .net

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages