ostranme / swagger-ui-themes Goto Github PK
View Code? Open in Web Editor NEW:boom: A collection of css themes to spice up your Swagger docs
Home Page: http://ostranme.github.io/swagger-ui-themes/
:boom: A collection of css themes to spice up your Swagger docs
Home Page: http://ostranme.github.io/swagger-ui-themes/
Create a light version of Flattop theme
Hi,
here are some suggestions to make feeling blue just a little bit more blue. ;-)
.swagger-section #header {
background-color: #0489bf;
}
.swagger-section .swagger-ui-wrap a {
color: #00547f;
}
.swagger-section .swagger-ui-wrap pre {
background-color: #f6f6fc;
}
.swagger-section .swagger-ui-wrap .model-signature pre:hover {
background-color: #e6e6fc;
}
Preface: Apologies if this is a noobish question, Frontend development is not my domain of expertise. :(
I cannot get Swagger-UI 3.x to load any 3.x swagger-ui-theme CSS. Rather, the default CSS theme is always being loaded. Using my browser's debug tools I can see the JS console is error free, and the theme-xxx.css I specify (using your instructions) is in fact being served to the browser.
Below is a Dockerfile and a couple BASH commands to replicate the issue quickly (all work on Linux or Windows + Cygwin + Docker Toolbox).
Dockerfile
:FROM swaggerapi/swagger-ui:v3.0.2
# mount an index file with the `<link rel="stylesheet" href="path/to/theme.css" />` one-liner
COPY ./index-feeling-blue.html /usr/share/nginx/html/index.html
COPY ./theme-feeling-blue.css /usr/share/nginx/html/css/theme-feeling-blue.css
EXPOSE 8080
Use your favorite means to obtain your preferred 3.x theme CSS from this repo (in my case feeling-blue).
Obtain the swagger-ui index.html
via this link (you may need to fix the paths to the swagger-ui js components) or from the docker image referenced in the first line:
docker pull swaggerapi/swagger-ui:v3.0.2
# use docker run to start a container using the swagger-ui image, and obtain its container id
$ docker run -d swaggerapi/swagger-ui:v3.0.2
<container_id>
# shell into the docker
$ docker exec -it <container_id> /bin/sh
/ # cat /usr/share/nginx/html/index.html
docker build -t <your_registry>/<your_image>:<your_tag> .
docker run -d -p 8080:8080 <your_registry>/<your_image>:<your_tag>
subj
Would be amazing to have dark mode, my eye cries on white bg
When using the version 2 of the CSS, the loader gif is not found.
Changing line 883 from:
background-image: url('../images/throbber.gif');
To:
background-image: url('../images/throbber-gif');
solved the problem.
I am attempting to try a theme on httpd on docker
and on gh-pages
. However, the css does not apply to the swagger.
Index.html:
<html>
<head>
<!-- Load the latest Swagger UI code from npm using unpkg.com -->
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"></script>
<!-- Load the theme -->
<link rel="stylesheet" type="text/css" href="/themes/css/theme-feeling-blue.css"/>
<title>My New API</title>
</head>
<body>
<a href="/">Go Back to Documentation</a>
<div id="swagger-ui"></div> <!-- Div to hold the UI component -->
<script>
window.onload = function () {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "swagger2.json", //Location of Open API spec in the repo
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
})
window.ui = ui
}
</script>
</body>
</html>
httpd conf mime types:
AddType 'text/css; charset=UTF-8' css
AddType text/javascript .js
Create a theme using different types/fonts. Bigger/smaller text.
Hi @ostranme,
would you mind to release this Repository under a License?
Maybe MIT or Apache 2?
Hover on model schema is yellow. Can't see attributes because they are white.
-Remove or change color.
If you can't insert the link in the source code, you can use the chrome extension : https://chrome.google.com/webstore/detail/swagger-ui-themes/mmbhchnmidfdfbecginjphmijieofngc
Applying the themes for v 3.x seems to work ok but probably a few things getting missed out - most blatant the "models" section at the bottom isn't themed at all, so I'm assuming that's new as of v4.
Any plans to accommodate?
Thanks
Hi,
the instruction says to place the desired stylesheet into the source of your swagger-ui html
When I'm in swagger editor: how do I obtain my swagger-ui html
? There's Generate Client => html
, Generate Client => html2
, I can right click the right pane and Save as
.
What is the right HTML page your CSS files style?
Best,
Bernhard Döbler
Would be great to keep the JSON highlighting.
Looks like it's this block:
.swagger-ui .opblock-body pre span {
color: #fff !important;
}
I like your themes very much, their colors are very cool!
But I think one thing is more important.
I hate the default style of swagger-ui's menus, I must to roll the mouse mid-wheels and click the small menus very frequently. It makes my hands tired. So, I think if we create a left-sidebar , and put the menus on it, it will be popular !
Were these themes developed using a css preprocessor? Any chance the file might be made available? I really like the Flat top theme but want to slightly modify it to match brand colors.
Thanks
Hover on model schema is yellow. Can't see attributes because they are white.
-Remove or change color.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.