[go: up one dir, main page]

Skip to content

oqo0/swagger-themes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

74 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Logo Swagger themes

github issues github last commits

Change Swagger documentation theme easily.

πŸ’Ύ Install

With NuGet CLI:

nuget install oqo0.SwaggerThemes

Using NuGet Package Manager: https://www.nuget.org/packages/oqo0.SwaggerThemes/

πŸ“š Usage

Select any theme from themes list and apply it using following ways:

πŸ“– Using with Swashbuckle

app.UseSwagger();
app.UseSwaggerThemes(Theme.UniversalDark);
app.UseSwaggerUI();

Important

Don't use UseSwaggerUI() before UseSwaggerThemes() or themes are not going to get installed.

πŸ“– Using with NSwag

app.UseOpenApi();
app.UseSwaggerUi(options =>
{
    options.CustomInlineStyles = SwaggerTheme.GetSwaggerThemeCss(Theme.UniversalDark);
});

πŸ”§ Adding custom CSS

string customCss = "body {" +
                   "    background-color: red;" +
                   "}";

app.UseSwaggerThemes(Theme.UniversalDark, customCss );

🎨 Themes

Dracula

alt text

Theme.Dracula

Gruvbox

alt text

Theme.Gruvbox

Monokai

alt text

Theme.Monokai

Nord Dark

alt text

Theme.NordDark

One Dark

alt text

Theme.OneDark

Universal Dark

alt text

Theme.UniversalDark

X-Code Light

alt text

Theme.XCodeLight

Sepia

alt text

Theme.Sepia

πŸ’‘ Creating your own themes

  1. Create theme .css in Themes directory.
  2. Add a placeholder for filename in Theme.cs:
public static Theme YourTheme => new("your-theme.css");
  1. Add an embedded resource for your .css file:
    ...
    <EmbeddedResource Include="Themes\your-theme.css" />
</ItemGroup>
  1. Use any other complete theme as a template.
  2. Build project:
dotnet build -c Release
  1. Package .nupkg file is going to appear in ./bin/Release