Skip to content

Commit

Permalink
CSS and themes.
Browse files Browse the repository at this point in the history
Added `Theme Variables` and `CSS Elements` to documentation.
Renamed `custom-bar-card-color` theme variable to `bar-card-color`.
Removed unused element.
  • Loading branch information
Gluwc committed Apr 6, 2020
1 parent d351d70 commit 42af36f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,36 @@ Bar Card is a customizable animated card for the Home Assistant Lovelace front-e
| minmax | string | off | `inside`, `outside`, `off`
| value | string | inside | `inside`, `outside`, `off`

## Theme Variables

| Name | Description
| ---- | ----
| bar-card-color | Defines the default bar color.
| bar-card-border-radius | Defines the border radius of the bar.
| bar-card-disabled-color | Defines the bar color when state is `unavailable`.

## CSS Elements

| Name | Description
| ---- | ----
| bar-card-card | The root bar of each defined entity containing all elements.
| bar-card-background | Contains bar and any elements `outside` of the bar.
| bar-card-backgroundbar | The background of the bar.
| bar-card-current | The filled part of the bar.
| bar-card-contentbar | Contains all elements `inside` of the bar.
| ha-icon | Icon element.
| bar-card-iconbar | Contains ha-icon.
| bar-card-title | Title element.
| bar-card-minvalue | Min value element.
| bar-card-divider | Min/Max divider element.
| bar-card-maxvalue | Max value element.
| bar-card-value | Value element.
| bar-card-animationbar | Animated part of the bar.
| bar-card-targetbar | Target bar element.
| bar-card-targetmarker | Target marker element.
| bar-card-indicator | Indicator element.


## Installation

Prefered method of installation is [Home Assistant Community Store](https://github.com/hacs/integration).
Expand Down
8 changes: 3 additions & 5 deletions src/bar-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BarCard extends HTMLElement {
delay: 5000,
speed: 1000
},
color: 'var(--custom-bar-card-color, var(--primary-color))',
color: 'var(--bar-card-color, var(--primary-color))',
decimal: false,
direction: 'right',
height: '40px',
Expand Down Expand Up @@ -236,8 +236,6 @@ class BarCard extends HTMLElement {
iconBar.id = 'iconBar_' + id;
const title = document.createElement('bar-card-title');
title.id = 'title_' + id;
const titleBar = document.createElement('bar-card-titlebar');
titleBar.id = 'titleBar_' + id;
const minValue = document.createElement('bar-card-minvalue');
minValue.id = 'minValue_' + id;
const divider = document.createElement('bar-card-divider');
Expand All @@ -247,9 +245,9 @@ class BarCard extends HTMLElement {
maxValue.id = 'maxValue_' + id;
const value = document.createElement('bar-card-value');
value.id = 'value_' + id;
const animationBar = document.createElement('bar-card-animationBar');
const animationBar = document.createElement('bar-card-animationbar');
animationBar.id = 'animationBar_' + id;
const targetBar = document.createElement('bar-card-targetBar');
const targetBar = document.createElement('bar-card-targetbar');
targetBar.id = 'targetBar_' + id;
const targetMarker = document.createElement('bar-card-targetmarker');
targetMarker.id = 'targetMarker_' + id;
Expand Down

0 comments on commit 42af36f

Please sign in to comment.