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

Theme configuration support #48

Merged
merged 29 commits into from Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
dac3cc6
:hammer: add methods
timmo001 Aug 21, 2018
0317ff2
:rocket: update openssh-client package
timmo001 Aug 22, 2018
f501cc3
:hammer: add methods
timmo001 Aug 21, 2018
c320599
Merge branch 'theme-support' of github.com:timmo001/home-panel into t…
timmo001 Aug 22, 2018
27e511b
:fire: fix array copying
timmo001 Aug 23, 2018
e46de1d
:hammer: cleanup
timmo001 Aug 23, 2018
d0883f3
:hammer: add clone util
timmo001 Aug 24, 2018
3ff2ff7
:hammer: clone object
timmo001 Aug 24, 2018
d7b7064
:hammer: cleanup
timmo001 Aug 24, 2018
fb6d6cb
:sparkles: map colors
timmo001 Aug 24, 2018
9a980d3
:hammer: set buttons to text colors
timmo001 Aug 24, 2018
033b848
:sparkles: support for images
timmo001 Aug 24, 2018
0e3d9f2
:sparkles: :hammer: rewrite themes and fix css js
timmo001 Aug 24, 2018
40b55b8
:hammer: cleanup and theming fixes
timmo001 Aug 24, 2018
8e1973b
:art: add theme screenshots
timmo001 Aug 24, 2018
908088e
:hammer: cleanup
timmo001 Aug 24, 2018
9a861c7
:books: add theme documentation
timmo001 Aug 24, 2018
2195f1a
:books: split into sections
timmo001 Aug 24, 2018
82709fb
:books: update docs
timmo001 Aug 24, 2018
f1ce225
:books: :art: add theme screenshots
timmo001 Aug 24, 2018
668890b
:hammer: fix items
timmo001 Aug 24, 2018
d5834fe
:hammer: fix linting issuses
timmo001 Aug 24, 2018
9ff9d60
:hammer: mdl fix
timmo001 Aug 24, 2018
6f7e10e
:hammer: fix indentation
timmo001 Aug 24, 2018
7c11ac9
:hammer: linter
timmo001 Aug 24, 2018
9a5c026
:hammer: fix
timmo001 Aug 24, 2018
947a6ae
:hammer: lint
timmo001 Aug 24, 2018
59c30b1
:hammer: formatting
timmo001 Aug 24, 2018
29c4d06
:hammer: mdl style
timmo001 Aug 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions .github/release-drafter.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .gitlab-ci.yml
Expand Up @@ -96,15 +96,15 @@ markdownlint:
- gem install mdl
- mdl --version
script:
- mdl --style all --warnings .
- mdl -s mdl_style.rb --warnings .

# Pages jobs
mkdocs:
stage: pages
image: python:3.7.0-alpine3.8
script:
- rm -f ~/.gitconfig && rm -Rf ~/.ssh
- apk add --no-cache git=2.18.0-r0 git-fast-import=2.18.0-r0 openssh-client=7.7_p1-r2 bash=4.4.19-r1
- apk add --no-cache git=2.18.0-r0 git-fast-import=2.18.0-r0 openssh-client=7.7_p1-r3 bash=4.4.19-r1
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- echo "$GIT_SSH_PUB_KEY" > ~/.ssh/id_rsa.pub
Expand Down
5 changes: 5 additions & 0 deletions docs/docs/configuration.md
Expand Up @@ -30,6 +30,10 @@ The sensor below is an LDR sensor which sets the *dark* theme when below
},
```

## custom

You can create custom themes in an array here. See the the docs [here][themes].

## header

This section can display weather and other sensor information in the top
Expand Down Expand Up @@ -359,3 +363,4 @@ The url of a still image for use in the main view. This updates every minute.
[header]: https://raw.githubusercontent.com/timmo001/home-panel/master/docs/resources/header.png
[weather-left]: https://raw.githubusercontent.com/timmo001/home-panel/master/docs/resources/weather-left.png
[weather-right]: https://raw.githubusercontent.com/timmo001/home-panel/master/docs/resources/weather-right.png
[themes]: https://git.timmo.xyz/home-panel/themes/
26 changes: 23 additions & 3 deletions docs/docs/template.md
@@ -1,9 +1,30 @@
# Starter Template

```json

{
"theme": {},
"theme": {
"custom": [
{
"name": "Midnight",
"base": "dark",
"overrides": {
"backgrounds": {
"main": "#383c45",
"default": "#383c45",
"card": {
"on": "pink[600]",
"off": "#434954",
"disabled": "#7f848e"
}
},
"text": {
"light": "grey[50]",
"main": "grey[100]"
}
}
}
]
},
"header": {
"left_outdoor_weather": {
"dark_sky_icon": "sensor.dark_sky_icon",
Expand Down Expand Up @@ -54,5 +75,4 @@
}
]
}

```
85 changes: 85 additions & 0 deletions docs/docs/themes.md
@@ -0,0 +1,85 @@
# Custom Themes

This section covers creating custom themes in the config.

Start by adding an array called `custom` under the `theme` object in the
config or use the [template][template].

```json
"theme": {
"custom": [
]
}
```

## Configurable items

Here is a table of all parts of the theme that can be overridden/configured.
Replace the dots (.) with an object. (`"backgrounds": { ... }`)

| Item | What this configures/overrides |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type | The top level base. This is the high level theme which can only be light or dark. Generally this isn't needed when using the light or dark theme as the `base` |
| primary | The primary color that the UI uses. |
| secondary | The secondary color that the UI uses. |
| backgrounds.main | The main background. This can be a color or a picture. You must use css formatting however, so to use an image, use `url(https://myimageaddress...) |
| backgrounds.default | The background that other sections use that don't already have. This is generally not needed. |
| backgrounds.card.on | The color of the card when on. i.e. the light or switch is turned on. |
| backgrounds.card.off | The color of the card when switched off or not able to switch on |
| backgrounds.card.disabled | The color of the card when the entity is unavailable. |
| theme.overrides.text.light | The color of the lighter text and icons |
| theme.overrides.text.main | The color of the main text and icons. This is mostly the header section with the time, weather etc. |

## Example Themes

Here are some example themes you can use or expand on. Contributions welcome!

### Midnight

```json
{
"name": "Midnight",
"base": "dark",
"overrides": {
"backgrounds": {
"main": "#383c45",
"default": "#383c45",
"card": {
"on": "pink[600]",
"off": "#434954",
"disabled": "#7f848e"
}
},
"text": {
"light": "grey[50]",
"main": "grey[100]"
}
}
}
```

![Midnight Theme][theme-midnight]

### Forest

```json
{
"name": "Forest",
"base": "light",
"overrides": {
"backgrounds": {
"main": "url(https://images.pexels.com/photos/4827/nature-forest-trees-fog.jpeg)",
"card": {
"on": "lightGreen[700]",
"off": "green[50]"
}
}
}
}
```

![Forest Theme][theme-forest]

[template]: https://git.timmo.xyz/home-panel/template/
[theme-midnight]: https://raw.githubusercontent.com/timmo001/home-panel/master/docs/resources/theme-midnight.png
[theme-forest]: https://raw.githubusercontent.com/timmo001/home-panel/master/docs/resources/theme-forest.png
12 changes: 8 additions & 4 deletions docs/mkdocs.yml
@@ -1,3 +1,4 @@
---
site_name: Home Panel
site_description: A touch-compatible web-app for controlling the home
site_author: Timmo
Expand Down Expand Up @@ -63,10 +64,13 @@ markdown_extensions:
# Pages
nav:
- Overview: index.md
- Setup: setup.md
- Login: login.md
- Configuration: configuration.md
- Template: template.md
- Getting Started:
- Setup: setup.md
- Login: login.md
- Customization:
- Configuration: configuration.md
- Themes: themes.md
- Template: template.md
- Troubleshooting: troubleshooting.md
- Contributing: contributing.md
- License: license.md
Binary file added docs/resources/theme-forest.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/resources/theme-midnight.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions mdl_style.rb
@@ -0,0 +1,2 @@
all
rule 'MD013', :tables => false