Skip to content

Commit

Permalink
added background CSS feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Will Latourelle authored and Will Latourelle committed May 27, 2020
1 parent 9e813e3 commit d02735a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ views:
| included_devices | list (string) | **Optional** | List of devices that will display animated background. If this option is set any devices not included in this list will be excluded. Ex: iphone, ipad, windows, macintosh, android
| excluded_users | list (string) | **Optional** | Users to be excluded
| excluded_devices | list (string) | **Optional** | Devices to be excluded Ex: iphone, ipad, windows, macintosh, android
| background | string | **Optional** | CSS option for the background overlay. Default is 'transparent'

## Example if you want a different background for night and day when a switch changes (or any combination of entities)
A few people have asked about tying this to multiple entities. The good news is this is already possible with the use of a template sensor. Here is an example of a template sensor that would allow a different background for night/day when a bedroom switch changes.
Expand Down
12 changes: 8 additions & 4 deletions dist/animated-background.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,9 +526,13 @@ function urlIsVideo(url){
}

//removes lovelace theme background
function removeDefaultBackground(node) {
if (node.style.background != 'transparent' || View_Layout.style.background != 'transparent') {
node.style.background = 'transparent';
function removeDefaultBackground(node, current_config) {
var background = 'transparent';
if(current_config.background){
background = current_config.background;
}
if (node.style.background != background || View_Layout.style.background != 'transparent') {
node.style.background = background;
View_Layout.style.background = 'transparent';
}
}
Expand Down Expand Up @@ -565,7 +569,7 @@ function processDefaultBackground(temp_enabled) {
iphone_bullshit_fixer = view_node_panel;
}
if (temp_enabled) {
removeDefaultBackground(iphone_bullshit_fixer);
removeDefaultBackground(iphone_bullshit_fixer, current_config);
DEBUG_MESSAGE("Removing view background for configuration:", currentConfig(), true);
}
else {
Expand Down

0 comments on commit d02735a

Please sign in to comment.