AspNetCore.SwaggerUI.Themes 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package AspNetCore.SwaggerUI.Themes --version 0.1.0                
NuGet\Install-Package AspNetCore.SwaggerUI.Themes -Version 0.1.0                
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="AspNetCore.SwaggerUI.Themes" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AspNetCore.SwaggerUI.Themes --version 0.1.0                
#r "nuget: AspNetCore.SwaggerUI.Themes, 0.1.0"                
#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.
// Install AspNetCore.SwaggerUI.Themes as a Cake Addin
#addin nuget:?package=AspNetCore.SwaggerUI.Themes&version=0.1.0

// Install AspNetCore.SwaggerUI.Themes as a Cake Tool
#tool nuget:?package=AspNetCore.SwaggerUI.Themes&version=0.1.0                

SwaggerUI.Themes

Build

TODO: add nuget version badge

AspNetCore.SwaggerUI.Themes is a package that extends Swashbuckle.AspNetCore.SwaggerUI to provide new themes for Swagger documentation in ASP.NET Core applications.

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 a modern themes, including dark theme. Currently, only the Dark style is available; additional styles will be introduced in the future.
  • Seamless Integration: Simply install the package and add the style parameter to the existing method used for SwaggerUI.

Getting Started

To use AspNetCore.SwaggerUI.Themes in your ASP.NET Core project, follow these steps:

  1. Install the package using .NET CLI or NuGet Package Manager:

     dotnet add package AspNetCore.SwaggerUI.Themes
    

    or

     Install-Package AspNetCore.SwaggerUI.Themes
    
  2. In your Program.cs file, add the style through the Style 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.cs and Program.cs files, the following code should be configured within the Configure method of the Startup 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(Style.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 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. 
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
2.0.0 86 11/18/2024
1.0.0 3,275 8/19/2024
0.5.1 372 7/1/2024
0.5.0 977 3/24/2024
0.4.0 186 3/3/2024
0.3.0 146 2/22/2024
0.2.0 171 1/25/2024
0.1.0 145 1/22/2024