AspNetCore.SwaggerUI.Themes
0.3.0
See the version list below for details.
dotnet add package AspNetCore.SwaggerUI.Themes --version 0.3.0
NuGet\Install-Package AspNetCore.SwaggerUI.Themes -Version 0.3.0
<PackageReference Include="AspNetCore.SwaggerUI.Themes" Version="0.3.0" />
paket add AspNetCore.SwaggerUI.Themes --version 0.3.0
#r "nuget: AspNetCore.SwaggerUI.Themes, 0.3.0"
// Install AspNetCore.SwaggerUI.Themes as a Cake Addin #addin nuget:?package=AspNetCore.SwaggerUI.Themes&version=0.3.0 // Install AspNetCore.SwaggerUI.Themes as a Cake Tool #tool nuget:?package=AspNetCore.SwaggerUI.Themes&version=0.3.0
<span align="center">
<p> <img height="50" src="\build\icon.png" align="center"> </p>
SwaggerUI.Themes
</span> <p align="center"> <a href="https://github.com/teociaps/SwaggerUI.Themes/actions/workflows/build.yml"> <img alt="Build Passing" src="https://github.com/teociaps/SwaggerUI.Themes/actions/workflows/build.yml/badge.svg" /> </a> <a href="https://github.com/teociaps/SwaggerUI.Themes/actions/workflows/test.yml"> <img alt="Tests Passing" src="https://github.com/teociaps/SwaggerUI.Themes/actions/workflows/test.yml/badge.svg" /> </a> <a href="https://www.nuget.org/packages/AspNetCore.SwaggerUI.Themes"> <img alt="NuGet Version" src="https://img.shields.io/nuget/v/AspNetCore.SwaggerUI.Themes?logo=nuget&color=blue" /> </a> </p> <span align="center">
AspNetCore.SwaggerUI.Themes is a package that extends Swashbuckle.AspNetCore.SwaggerUI to provide new themes for Swagger documentation in ASP.NET Core applications.
</span>
Introduction
Swashbuckle.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.
Features
- New Themes: enhances the Swagger documentation interface with different themes, including a default style that retains the classic Swagger UI appearance and new modern styles.
- Seamless Integration: simply install the package and add the style parameter to the existing method used for SwaggerUI.
Themes
There are a few themes available for your Swagger UI:
Default Styles
- Dark: offers a simple dark-themed interface, maintaining the classic Swagger UI layout;
- Forest: inspired by the colors of a forest, this theme brings a natural and vibrant feel to your documentation;
- DeepSea: inspired by the depths of the sea, this theme features cool blues and deep greens for a tranquil and immersive experience.
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.
Modern Styles
- Light: offers a modern, light-themed interface that overrides some aspects of the default Swagger UI;
- Dark: provides a sleek, dark-themed interface for a more modern look and feel.
Supported .NET Versions
Version | Status |
---|---|
.NET 6 | |
.NET 7 | |
.NET 8 |
Version History
The table below provides a quick overview of AspNetCore.SwaggerUI.Themes versions and their compatibility with different .NET versions.
Library Version | .NET 6 | .NET 7 | .NET 8 |
---|---|---|---|
0.1.0 | ❌ | ❌ | ✔ |
0.2.0 + | ✔ | ✔ | ✔ |
- ✔️ Supported: The library version is compatible with the respective .NET version.
- ❌ Unsupported: The library version is not compatible with the respective .NET version.
Getting Started
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 theStyle
orModernStyle
class as new parameter ofapp.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.cs
andProgram.cs
files, the previously code should be configured within theConfigure
method of theStartup
class.
Example
Here's an example of how to integrate AspNetCore.SwaggerUI.Themes in your ASP.NET Core application:
using AspNetCore.SwaggerUI.Themes;
...
// Add services to the container. Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
...
// Use Swagger middleware
app.UseSwagger();
// Enable the dark theme for Swagger UI
app.UseSwaggerUI(ModernStyle.Dark, c =>
{
// Your Swagger UI configuration here (optional)
});
...
That's it! Your Swagger UI will now have a sleek dark theme.
Please note that using the
InjectStylesheet()
method in the Swagger UI configuration will override the provided style.
Contributing
If you have any suggestions, bug reports, or contributions, feel free to open an issue or submit a pull request
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
-
net6.0
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.5.0)
-
net7.0
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.5.0)
-
net8.0
- Swashbuckle.AspNetCore.SwaggerUI (>= 6.5.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.