ktsu.ThemeProvider.ImGui 1.0.7

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package ktsu.ThemeProvider.ImGui --version 1.0.7
                    
NuGet\Install-Package ktsu.ThemeProvider.ImGui -Version 1.0.7
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ktsu.ThemeProvider.ImGui" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ktsu.ThemeProvider.ImGui" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="ktsu.ThemeProvider.ImGui" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ktsu.ThemeProvider.ImGui --version 1.0.7
                    
#r "nuget: ktsu.ThemeProvider.ImGui, 1.0.7"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ktsu.ThemeProvider.ImGui@1.0.7
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ktsu.ThemeProvider.ImGui&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=ktsu.ThemeProvider.ImGui&version=1.0.7
                    
Install as a Cake Tool

ThemeProvider

A semantic color theming library for .NET applications

ThemeProvider is a comprehensive theming system that uses semantic color specifications rather than arbitrary color names. It provides a unified approach to theming across different UI frameworks through intelligent color mapping and includes 44+ carefully crafted themes from popular color schemes.

✨ Key Features

  • 🎨 44+ Beautiful Themes: Carefully crafted themes including Catppuccin, Tokyo Night, Gruvbox, Nord, Dracula, and many more
  • 🧠 Semantic Color System: Define colors by purpose (primary, accent, warning) rather than appearance (blue, red, green)
  • 🎯 Centralized Theme Registry: Easy discovery and management of all available themes
  • 🔌 Framework Integration: Built-in support for Dear ImGui with extensible architecture for other frameworks
  • ⚡ Intelligent Color Mapping: Automatic priority-based color interpolation and extrapolation
  • ♿ Accessibility-First: WCAG contrast ratio calculations and accessibility level checking
  • 🎛️ Advanced Color Science: Perceptually uniform color space (OKLCh) for natural color operations

🚀 Quick Start

Installation

dotnet add package ktsu.ThemeProvider
# For ImGui integration:
dotnet add package ktsu.ThemeProvider.ImGui

Basic Usage

using ktsu.ThemeProvider;
using static ktsu.ThemeProvider.ThemeRegistry;

// Discover available themes
var allThemes = AllThemes;
var darkThemes = DarkThemes;
var catppuccinThemes = GetThemesInFamily("Catppuccin");

// Find and create a specific theme
var themeInfo = FindTheme("Catppuccin Mocha");
var theme = themeInfo?.CreateInstance();

// Request semantic colors
var primaryColor = theme.GetColor(new SemanticColorRequest(SemanticMeaning.Primary, Priority.Medium));
var warningColor = theme.GetColor(new SemanticColorRequest(SemanticMeaning.Warning, Priority.High));

Framework Integration (Dear ImGui)

using ktsu.ThemeProvider.ImGui;

// Create theme and mapper
var theme = new Themes.Catppuccin.Mocha();
var imguiMapper = new ImGuiPaletteMapper();

// Get complete ImGui color palette
var imguiColors = imguiMapper.MapTheme(theme);

// Apply to ImGui (in your render loop)
var style = ImGui.GetStyle();
foreach ((ImGuiCol colorKey, Vector4 colorValue) in imguiColors)
{
    style.Colors[(int)colorKey] = colorValue;
}

🎨 Available Themes

Theme Registry

The ThemeRegistry provides centralized access to all available themes with rich metadata:

// Browse themes by family
foreach (string family in Families)
{
    var themesInFamily = GetThemesInFamily(family);
    Console.WriteLine($"{family}: {themesInFamily.Length} variants");
}

// Filter themes
var lightThemes = LightThemes;
var darkThemes = DarkThemes;

// Create theme instances
var allThemeInstances = CreateAllThemeInstances();
var gruvboxInstances = CreateThemeInstancesInFamily("Gruvbox");

Supported Themes (44 total)

Family Variants Description
Catppuccin 4 variants (Latte, Frappe, Macchiato, Mocha) Warm pastel themes with excellent readability
Tokyo Night 3 variants (Night, Storm, Day) Clean themes inspired by Tokyo's neon nights
Gruvbox 6 variants (Dark, Light × Hard, Medium, Soft) Retro groove colors with warm backgrounds
Everforest 6 variants (Dark, Light × Hard, Medium, Soft) Green forest colors for comfortable viewing
Nightfox 7 variants (Nightfox, Dayfox, Duskfox, etc.) Fox-inspired vibrant themes
Kanagawa 3 variants (Wave, Dragon, Lotus) Japanese-inspired themes
PaperColor 2 variants (Light, Dark) Material Design inspired themes
Single Variants Nord, Dracula, VSCode, One Dark, Monokai, Nightfly

🧠 Semantic Color System

Core Concepts

Instead of hardcoding colors like "blue" or "red", ThemeProvider uses semantic specifications:

// ❌ Traditional approach
var buttonColor = Color.Blue;
var errorColor = Color.Red;

// ✅ Semantic approach
var buttonColor = theme.GetColor(new SemanticColorRequest(SemanticMeaning.Primary, Priority.Medium));
var errorColor = theme.GetColor(new SemanticColorRequest(SemanticMeaning.Error, Priority.High));

Semantic Meanings

  • Primary: Main brand/accent colors
  • Alternate: Secondary accent colors
  • Neutral: Background, borders, inactive elements
  • CallToAction: Important buttons and highlights
  • Success/Warning/Error: Status and feedback colors
  • Information/Caution: Informational messaging

Priority System

Priorities control color intensity and importance:

  • VeryLow → VeryHigh: Automatically mapped to appropriate lightness values
  • Intelligent Interpolation: Colors between defined values are interpolated
  • Theme-Aware Ordering: Light themes use high-to-low priority mapping, dark themes use low-to-high

Advanced Color Operations

// Accessibility checking
float contrastRatio = ColorMath.GetContrastRatio(foreground, background);
var accessibilityLevel = ColorMath.GetAccessibilityLevel(foreground, background, isLargeText);

// Color space conversions
var oklchColor = rgbColor.ToOklch();
var adjustedColor = oklchColor.WithLightness(0.7f).ToRgb();

🔌 Framework Integration

Built-in ImGui Support

public class ImGuiPaletteMapper : IPaletteMapper<ImGuiCol, Vector4>
{
    public string FrameworkName => "Dear ImGui";
    
    public ImmutableDictionary<ImGuiCol, Vector4> MapTheme(ISemanticTheme theme)
    {
        // Systematic mapping of all ImGui colors using semantic specifications
    }
}

Creating Custom Framework Mappers

public class MyFrameworkMapper : IPaletteMapper<MyColorEnum, MyColorType>
{
    public string FrameworkName => "My UI Framework";
    
    public ImmutableDictionary<MyColorEnum, MyColorType> MapTheme(ISemanticTheme theme)
    {
        var requests = new Dictionary<MyColorEnum, SemanticColorRequest>
        {
            { MyColorEnum.Button, new(SemanticMeaning.Primary, Priority.Medium) },
            { MyColorEnum.Background, new(SemanticMeaning.Neutral, Priority.VeryLow) },
            // ... other mappings
        };

        var mappedColors = SemanticColorMapper.MapColors(requests.Values, theme);
        
        return requests.ToDictionary(
            kvp => kvp.Key,
            kvp => ConvertToMyColorType(mappedColors[kvp.Value])
        ).ToImmutableDictionary();
    }
}

📖 Examples

Complete Demo Application

The ThemeProviderDemo project showcases all features:

  • Theme Browser: Explore all 44 themes with metadata
  • Theme Overview: Visual semantic color grid for any theme
  • Semantic Colors: Interactive color request builder
  • ImGui Mapping: Live demonstration of framework integration
  • Accessibility: WCAG contrast ratio testing
  • UI Preview: Live preview of themed UI elements

Theme Usage Patterns

// Pattern 1: Direct theme usage
var theme = new Themes.Catppuccin.Mocha();
var primaryColor = theme.GetColor(new(SemanticMeaning.Primary, Priority.Medium));

// Pattern 2: Theme registry approach  
var themeInfo = FindTheme("Tokyo Night Storm");
var theme = themeInfo?.CreateInstance();

// Pattern 3: Bulk color mapping
var colorRequests = new[]
{
    new SemanticColorRequest(SemanticMeaning.Primary, Priority.Medium),
    new SemanticColorRequest(SemanticMeaning.Error, Priority.High),
    new SemanticColorRequest(SemanticMeaning.Success, Priority.High),
};
var mappedColors = SemanticColorMapper.MapColors(colorRequests, theme);

🏗️ Development

Building

dotnet build

Running the Demo

dotnet run --project ThemeProviderDemo

Project Structure

ThemeProvider/
├── ThemeProvider/              # Core semantic color system
│   ├── Themes/                # All 44 theme implementations  
│   ├── SemanticColorMapper.cs # Color interpolation engine
│   ├── ThemeRegistry.cs       # Centralized theme discovery
│   └── ColorMath.cs          # Accessibility and color operations
├── ThemeProvider.ImGui/       # Dear ImGui integration
└── ThemeProviderDemo/         # Comprehensive demo application

Design Principles [[memory:2677368]]

  • SOLID Architecture: Single responsibility, dependency inversion
  • DRY: Shared semantic specifications across frameworks
  • Semantic-First: Colors defined by purpose, not appearance
  • Accessibility: WCAG compliance built-in
  • Extensibility: Framework-agnostic core with pluggable mappers

📋 Requirements

📄 License

Licensed under the MIT License. See LICENSE.md for details.

🤝 Contributing

Contributions are welcome! Please ensure:

  1. Semantic Consistency: Follow semantic color principles
  2. Theme Quality: New themes should be well-balanced and accessible
  3. Documentation: Update documentation for new features
  4. Testing: Include accessibility and contrast validation

Made with ❤️ by ktsu.dev

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on ktsu.ThemeProvider.ImGui:

Package Downloads
ktsu.ImGuiStyler

A library for expressively styling ImGui.NET interfaces.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.9 104 9/4/2025
1.0.9-pre.3 135 8/25/2025
1.0.9-pre.2 444 7/24/2025
1.0.9-pre.1 492 7/23/2025
1.0.8 616 7/22/2025
1.0.7 492 7/22/2025
1.0.6 490 7/22/2025
1.0.6-pre.1 482 7/22/2025
1.0.5 480 7/21/2025

## v1.0.7 (patch)

Changes since v1.0.6:

- Add complete palette generation and improve ImGui color mapping ([@matt-edmondson](https://github.com/matt-edmondson))