Simple.SwaggerThemeToggler 1.0.16

dotnet add package Simple.SwaggerThemeToggler --version 1.0.16
                    
NuGet\Install-Package Simple.SwaggerThemeToggler -Version 1.0.16
                    
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="Simple.SwaggerThemeToggler" Version="1.0.16" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Simple.SwaggerThemeToggler" Version="1.0.16" />
                    
Directory.Packages.props
<PackageReference Include="Simple.SwaggerThemeToggler" />
                    
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 Simple.SwaggerThemeToggler --version 1.0.16
                    
#r "nuget: Simple.SwaggerThemeToggler, 1.0.16"
                    
#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 Simple.SwaggerThemeToggler@1.0.16
                    
#: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=Simple.SwaggerThemeToggler&version=1.0.16
                    
Install as a Cake Addin
#tool nuget:?package=Simple.SwaggerThemeToggler&version=1.0.16
                    
Install as a Cake Tool

Simple.SwaggerThemeToggler

GitHub Repo stars GitHub Actions Workflow Status NuGet version NuGet Downloads GitHub Issues


๐Ÿš€ Overview

Simple.SwaggerThemeToggler is a plug-and-play theme switcher for Swagger UI in .NET applications.
It adds a convenient dropdown menu so users can easily switch between multiple UI themes โ€“ including your own custom styles!

Supports both built-in themes and externally defined ones via JSON.
No complicated setup โ€“ just a few lines of code and you're done.


๐Ÿ”‘ Key Features

  • โšก Super quick and easy to integrate
  • ๐Ÿ› ๏ธ Comes with built-in themes
  • ๐ŸŽจ Supports custom themes via JSON
  • ๐Ÿงฉ .NET 8+ compatible

๐Ÿ“š Table of Contents

  1. Getting Started
  2. What it looks like
  3. Technical Information
  4. Known Issues & Limitations
  5. Contributing

๐Ÿšฆ Getting Started

To use Simple.SwaggerThemeToggler, install the NuGet package and activate it in your Program.cs.

๐Ÿ“ฆ Installing

Add a reference to the package:

dotnet add package Simple.SwaggerThemeToggler

๐Ÿงช Activating

๐Ÿ’ก Using Built-in Themes
app.UseSwaggerThemeToggler();

app.UseSwaggerUI(options =>
{
    options.AddSwaggerThemeToggler();
});

๐ŸŽจ Using Custom Themes

You need:

  1. A JSON file (e.g. in wwwroot/custom-themes/themes.json) that describes your custom themes:
[
  {
    "name": "My Example Theme",
    "file": "/custom-themes/my-example.css"
  },
  {
    "name": "Another Example Theme",
    "file": "/custom-themes/another-example.css"
  }
]
  1. The actual CSS files in the location you referenced in the JSON above.

Make sure you enable static file serving:

app.UseStaticFiles();

app.UseSwaggerThemeToggler();

app.UseSwaggerUI(options =>
{
    options.AddSwaggerThemeToggler("/custom-themes/themes.json");
});

๐Ÿ–ผ๏ธ What it looks like

Once activated, a dropdown will appear in the top-right corner of Swagger UI, allowing users to choose their preferred theme:

Screenshot


๐Ÿ”ฌ Technical Information

Built-in themes currently included:

  • Classic (default Swagger UI)
  • Classic Dark
  • Dracula Dark
  • Gruvbox Dark
  • Monokai Dark
  • Muted Light
  • Newspaper Light
  • Nord Dark
  • One Dark
  • Visual Studio Code Dark
  • Xcode Light

๐Ÿž Known Issues & Limitations

  • Some built-in themes need rework for better consistency ๐Ÿ”ฅ

๐Ÿค Contributing

Found a bug or want to suggest a new feature?
Feel free to open an issue or submit a pull request!


๐Ÿ“„ License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.16 347 7/10/2025
1.0.15 199 7/9/2025
1.0.14 197 7/9/2025
1.0.13 192 7/9/2025
1.0.12 201 7/9/2025
1.0.11 201 7/9/2025
1.0.10 207 7/8/2025
1.0.9 199 7/8/2025
1.0.8 184 7/8/2025
1.0.7 191 7/8/2025
1.0.0 199 7/8/2025