Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration options for custom CSS #44

Open
usimd opened this issue Jun 10, 2024 · 1 comment · May be fixed by #45
Open

Configuration options for custom CSS #44

usimd opened this issue Jun 10, 2024 · 1 comment · May be fixed by #45

Comments

@usimd
Copy link

usimd commented Jun 10, 2024

In addition to the existing options to configure SwaggerUI itself via its parameters, it would be great to have the ability to add custom CSS as well (https://github.com/ostranme/swagger-ui-themes for instance seems fairly popular).

From my point of view it would be enough to provide an additional <link> tag with href being populated from a config parameter (if defined) after

<link rel="stylesheet" type="text/css" href="{{ url_prefix }}/static/index.css" />

The content served at the route could then easily be managed by the user, something like (pseudo)

api_doc(app, config_path='./config/test.yaml', url_prefix='/api/doc', custom_css='/static/custom.css')

@app.route('/static/custom.css')
def custom_css():
    css = 'h1 { color: blue; }'
    return Response(css, mimetype='text/css')

What do you think? Would be willing to contribute a PR for this.

@PWZER
Copy link
Owner

PWZER commented Jun 21, 2024

@usimd Yes, that's a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants