Skip to content

Introducing Dynamic Theme Switcher#39

Merged
teociaps merged 19 commits intomainfrom
theme-switcher
Nov 27, 2025
Merged

Introducing Dynamic Theme Switcher#39
teociaps merged 19 commits intomainfrom
theme-switcher

Conversation

@teociaps
Copy link
Owner

Introduced a theme switcher feature enabling users to dynamically switch between predefined and custom themes in Swagger UI. Added support for predefined themes and custom themes.

In addition, this pull request makes significant improvements to project documentation, contribution guidelines, and code of conduct, as well as minor build configuration updates. The most impactful changes are comprehensive rewrites and enhancements to README.md and CONTRIBUTING.md to better guide users and contributors, an updated and clarified code of conduct, and minor fixes for build and packaging.

Documentation and Community Improvements:

  • Major rewrite and modernization of README.md:

    • Adds quick start instructions, feature highlights, usage examples for both Swashbuckle and NSwag, and clearer links to documentation and migration guides.
    • Improves visuals, badges, and package information, making the project more approachable for new users.
  • Substantial overhaul of CONTRIBUTING.md:

    • Expands and clarifies contribution steps, project structure, and theme development workflow.
    • Provides detailed minification, testing, and pull request guidelines, including best practices and troubleshooting tips.
    • Adds sections for bug reporting, feature suggestions, and development tips.
  • Updated and expanded CODE_OF_CONDUCT.md:

    • Adopts Contributor Covenant v3.0, clarifies reporting and enforcement, and modernizes language to emphasize inclusivity and community health.

Build and Packaging Adjustments:

  • Updates SwaggerUI.Themes.sln for Visual Studio 18 compatibility.
  • Adds Release build optimization in build/Common.Core.props.
  • Fixes NuGet packaging path for package-readme.md in build/NuGet.props.

- Removed "classic" and "modern" styles in favor of just one single style.
- Introduced `standalone.style.css` for independent themes without dependencies on `common.css` or `ui.js`.
- Enhanced maintainability by restructuring CSS files and removing unused styles.
- Removed "modern." prefixes from CSS/JS filenames for simplicity.
- Consolidated `Style` and `ModernStyle` into a single `Theme` class.
- Renamed all "Style" references to "Theme" across the codebase.
- Added support for standalone themes (no `common.css` or `ui.js`).
- Updated `FileProvider.cs` to handle themes and standalone logic.
- Refactored `SwaggerUIBuilderExtensions` and `NSwagBuilderExtensions`.
- Updated tests, samples, and documentation to reflect changes.
- Removed classic styles and related logic (breaking change).
Revised README.md and package-readme.md to improve clarity, structure, and visual appeal. Added new sections for quick start, features, and breaking changes. Updated badges, links, and examples for Swashbuckle and NSwag.

Adjusted NuGet.props to fix `PackagePath` for `package-readme.md`.

Updated readme.txt with detailed release notes for v3.0.0, highlighting breaking changes, .NET 10 support, and other improvements.

Enhanced user guidance with links to migration guides and documentation.
Introduced a theme switcher feature enabling users to dynamically switch between predefined and custom themes in Swagger UI. Added support for predefined themes and custom themes.

Enhanced `Program.cs` with examples of using themes and advanced options. Updated `FileProvider.cs` to expose theme metadata as a JSON endpoint for the theme switcher. Refactored `BaseTheme.cs` for better theme name handling.

Updated CSS and JavaScript files to support the theme switcher, including dropdown styles and runtime switching logic. Added new CSS files for predefined and custom themes. Improved caching, resource management, and advanced UI features in `AdvancedOptions.cs` and `FileProvider.cs`.

Enhanced testing coverage with `ThemeSwitcherTests`, `FileProviderMiddlewareTests`, and updates to `ThemeProviderTests`. Improved documentation, comments, and ensured backward compatibility with existing configurations.
- Support organizing themes in subfolders (SwaggerThemes.CompanyThemes.*, etc.)
- Fix exact filename matching: "custom.css" no longer matches "standalone.custom.css"
- Add comprehensive tests with real duplicate files
Updated CONTRIBUTING.md to enhance readability and organization:
- Reworded "How to Contribute" steps for better emphasis.
- Added a "Project Structure" section to explain the codebase layout.
- Enhanced "Working with Themes" with clearer minification steps.
- Introduced a "Testing Your Changes" section with detailed instructions.
- Improved "Pull Request Guidelines" with best practices for PRs.
- Expanded "Reporting Bugs" and "Suggesting Features" sections.
- Added a "Development Tips" section for rapid iteration and theme organization.
- Clarified licensing terms and added a friendly closing note.
- Updated contributor credit with a link to @teociaps' GitHub profile.
…igurer

- Downgraded `Swashbuckle.AspNetCore` to version `9.0.6` (v10 as dependency has to many breaking changes).
- Upgraded `NSwag.AspNetCore` to latest.
@teociaps teociaps added this to the v3.0.0 milestone Nov 27, 2025
@teociaps teociaps self-assigned this Nov 27, 2025
@teociaps teociaps added documentation Improvements or additions to documentation enhancement New feature or request completed The feature or bug fix is completed and needs to be published labels Nov 27, 2025
@teociaps teociaps marked this pull request as ready for review November 27, 2025 23:27
@teociaps teociaps merged commit 0cd6428 into main Nov 27, 2025
@teociaps teociaps deleted the theme-switcher branch November 27, 2025 23:33
@teociaps teociaps added fixed Issue fixed in current or prior release and removed completed The feature or bug fix is completed and needs to be published labels Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request fixed Issue fixed in current or prior release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant