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

Added support for theme from settings.py rather than just from the cli #396

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ To customize Grip, create `~/.grip/settings.py`, then add one or more of the fol
- `AUTOREFRESH`: Whether to automatically refresh the Readme content when the file changes, `True` by default
- `QUIET`: Do not print extended information, `False` by default
- `STYLE_URLS`: Additional URLs that will be added to the rendered page, `[]` by default
- `THEME`: The theme to use when not provided as a CLI argument, `light` by default
- `USERNAME`: The username to use when not provided as a CLI argument, `None` by default
- `PASSWORD`: The password or [personal access token][] to use when not provided as a CLI argument (*Please don't save your passwords here.* Instead, use an access token or drop in this code [grab your password from a password manager][keychain-access]), `None` by default

Expand Down
3 changes: 3 additions & 0 deletions grip/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ def __init__(self, source=None, auth=None, renderer=None,
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
self.theme = theme
localtheme = self.config['THEME']
if localtheme:
self.theme = localtheme

# Overridable attributes
if self.renderer is None:
Expand Down
3 changes: 3 additions & 0 deletions grip/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@

# Custom styles
STYLE_URLS = []

# Custome theme
THEME = 'light'