Modernize your ASP.NET Core Swagger UI with runtime theme switching, deep customization, and new functional UI features.
$ dotnet add package AspNetCore.SwaggerUI.ThemesSwashbuckle.AspNetCore is a popular library for adding Swagger support to ASP.NET Core projects, making it easier to document and interact with your APIs.
AspNetCore.SwaggerUI.Themes builds upon Swashbuckle.AspNetCore.SwaggerUI, enhancing the Swagger UI with modern and visually appealing themes.
To use AspNetCore.SwaggerUI.Themes in your ASP.NET Core project, follow these steps:
Install the package using .NET CLI or NuGet Package Manager:
dotnet add package AspNetCore.SwaggerUI.Themes
or
Install-Package AspNetCore.SwaggerUI.Themes
In your Program.cs file, add the style through the Style or ModernStyle class as new parameter of app.UseSwaggerUI() method:
using AspNetCore.SwaggerUI.Themes;
...
app.UseSwaggerUI(Style.Dark);
This code enables the chosen theme for Swagger UI in your application.
Please be aware that for projects utilizing the older style template with separate
Startup.csandProgram.csfiles, the previously code should be configured within theConfiguremethod of the class.
StartupThere are a few styles available for your Swagger UI.
Offers a simple dark-themed interface, maintaining the classic Swagger UI layout.

Style.Dark
Inspired by the colors of a forest, this theme brings a natural and vibrant feel to your documentation.

Style.Forest
Inspired by the depths of the sea, this theme features cool blues and deep greens for a tranquil and immersive experience.

Style.DeepSea
The light style is not in this list because it's just the default one used by Swagger UI; to use that you don't need this library.
Offers a modern, light-themed interface that overrides some aspects of the default Swagger UI.

ModernStyle.Light
Provides a sleek, dark-themed interface for a more modern look and feel.

ModernStyle.Dark
Brings a natural feel to your documentation with colors inspired by the serene ambiance of a forest.

ModernStyle.Forest
Dive into a tranquil interface with cool blues and deep greens, inspired by the depths of the sea.

ModernStyle.DeepSea