npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@goattech/swagger-ui-themeable

v0.1.0-beta.0

Published

Rebuild of Swagger UI's CSS with support for CSS custom properties

Downloads

5

Readme

swagger-ui-themeable

A rebuild of Swagger UI's default stylesheet that uses CSS custom properties to better support custom themes.

Caveats

[!WARNING] Consider this package a proof-of-concept that may break or be unsupported at any time. If you find this package useful please consider leaving a comment in https://github.com/YellowKirby/swagger-ui-themeable/issues/1.

This package attempts to make as few changes as possible to the upstream stylesheet. Ideally this means it's a safe drop-in replacement, but also has a few drawbacks:

  • Stability: Variable names are automatically generated and may be changed or removed between different versions. See issue https://github.com/YellowKirby/swagger-ui-themeable/issues/1.
  • Browser Support: Some SASS features (such as lighten()) don't work with CSS variables. These have been replaced with color-mix(), and should be fairly equivalent but require a recent version of most browsers to work correctly.

Usage

Install with your favorite package manager

npm i @goattech/swagger-ui-themeable

Replace any import of the default Swagger UI CSS file with an import of this package:

// example JS import with swagger-ui-react
- import "swagger-ui-react/swagger-ui.css"
+ import "@goattech/swagger-ui-themeable/swagger-ui.css"

// example CSS import
- @import "swagger-ui/swagger-ui.css"
+ @import "@goattech/swagger-ui-themeable/swagger-ui.css"

Then define values for any of the CSS variables:

:root {
  --swagger-ui-font-sans-serif: Inter, ui-sans-serif;
  --swagger-ui-font-monospace: "IBM Plex Mono", ui-monospace;
  --swagger-ui-text-body-default-font-color: gray;
  --swagger-ui-color-bright-gray: gray;
  --swagger-ui-_color-post: lime;
  --swagger-ui-_color-get: indigo;
  --swagger-ui-_color-put: yellow;
  --swagger-ui-_color-delete: red;
  --swagger-ui-_color-head: purple;
  --swagger-ui-_color-patch: teal;
  --swagger-ui-_color-disabled: gray;
  --swagger-ui-color-method-options: lightblue;
  --swagger-ui-btn-authorize-font-color: lime;
  --swagger-ui-btn-authorize-border-color: lime;
}

What variables can be defined?

See the full list here. Provide any/all values for the --swagger-ui- variable names.

Development

  • ./generate.sh will fetch the latest master commit of upstream swagger-ui and run some sed replacements to define CSS variables. Currently this requires gsed (gnu-sed) that can be installed with brew install gnu-sed on OSX. Sorry other OS folks :(
  • npm run build will package it up.