Skip to content

Commit

Permalink
New card configuration option: circle_color
Browse files Browse the repository at this point in the history
  • Loading branch information
bessarabov committed Jun 17, 2020
1 parent 1dcec59 commit 1ad074f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# animated-consumption-card

## 1.3.0 (2020-06-17)

* New card configuration option: `circle_color`

## 1.2.0 (2020-05-21)

* Fixing mdi icon size in Home Assistant 0.110.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ but you can use it to customize the card.
| **left_icon** | [`mdi:electron-framework`](https://mdi.bessarabov.com/icon/electron-framework) | Left icon in the card |
| **right_icon** | [`mdi:home`](https://mdi.bessarabov.com/icon/home) | Right icon in the card |
| **show_line** | `false` | Showing a line between icons |
| **circle_color** | `var(--primary-color)` | Color of the moving cirle |
7 changes: 6 additions & 1 deletion animated-consumption-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ class AnimatedConsumptionCard extends HTMLElement {
this.showLine = true;
}

this.circleColor = "var(--primary-color)";
if (config.circle_color !== undefined) {
this.circleColor = config.circle_color;
}

this.contentIsCreated = false;

this.speed = 0;
Expand Down Expand Up @@ -150,7 +155,7 @@ class AnimatedConsumptionCard extends HTMLElement {
this.accCircle.setAttributeNS(null, "r", "10");
this.accCircle.setAttributeNS(null, "cx", this.startPosition);
this.accCircle.setAttributeNS(null, "cy", "20");
this.accCircle.setAttributeNS(null, "fill", "var(--primary-color)");
this.accCircle.setAttributeNS(null, "fill", this.circleColor);
this.querySelectorAll("svg").item(0).appendChild(this.accCircle);

this.contentIsCreated = true;
Expand Down
1 change: 1 addition & 0 deletions development/ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ views:

- type: 'custom:animated-consumption-card'
entity: input_number.input_number_2
circle_color: black

- type: 'custom:animated-consumption-card'

Expand Down

0 comments on commit 1ad074f

Please sign in to comment.