darkMode option with templating does not work correctly
See original GitHub issueVersion: v0.1.4
My Home Assistant backend-selected theme changes based on sun entity. Automation for that uses this blueprint.
This is my sun card configuration:
type: 'custom:sun-card'
darkMode: '{{ is_state("sun.sun", "below_horizon") }}'
I tried converting it to string too (see below).
Issue:
The card does not change appearance correctly. It is constantly rendered as if darkMode
was set to True
.
Templating outputs:
{{ is_state("sun.sun", "below_horizon") }} # False
{{ is_state("sun.sun", "below_horizon") is boolean }} # True
{{ is_state("sun.sun", "below_horizon") | string }} # False
{{ (is_state("sun.sun", "below_horizon") | string) is boolean }} # False
I tried {{ (states("sun.sun") == "below_horizon") }}
too but it gives same results.
- What would the correct/working configuration look like?
- DIfferent Lovelace cards don’t have
darkMode
option in configuration and they render correctly. Is that because they use themes colour palette for fonts? Why it’s not the case withsun-card
?
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to resolve issues with email dark mode
The dark mode setting is available on mobile, tablet, and PC. All users can activate ... The new email template corrects dark mode...
Read more >Fixing Problems With Borders in Dark Mode (Email Design)
Are your borders changing color or disappearing into the background when you test your HTML email in dark mode?
Read more >A Complete Guide to Dark Mode on the Web - CSS-Tricks
Dark mode ” is defined as a color scheme that uses light-colored text and ... Moreover, there's nothing saying we can only use...
Read more >Dark Mode Logo Problems: Six Ideas to Improve Email Design
2. A dark logo will disappear. Or, maybe your logo is a PNG with a transparent background. That should work, right? Well, maybe....
Read more >Dark Mode Email: Your Ultimate How-to Guide - Litmus
Yes, you read right. Some email clients let you change their UI to Dark Mode, but that doesn't have any impact on how...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I managed to work around this with card-mod:
I would just do this via a conditional. The below works great.