most reliable is using hex colors:
<h3><font color=#152b81>Lange termijn</font></h3>
theme colors are not used in the markdown.
not aware font is deprecated though, I use it all over, and no issue. even set a fat color on mdi icons…
will try and find the deprecation
oops thats ancient indeed…
well, replace it with
<h3 style="color=#152b81">Lange termijn</h3>
seems to work just as fine…
strike that… even though it is the advised way to do as stated all over the Stackoverflow posts, it does not work in HA markdown.
a plain example I took:
<span style="color:blue">some *This is Blue italic.* text</span>
renders the text alright, but without the color. Same with a hex color.
so we are indeed left to do stuff like:
ha-markdown $: |
h3 { font-family: “Helvetica, sans-serif”; font-size: 24px; color: #152b81; }
h4 { color: #152b81; }
but a Header to a text makes it move to its own line:
so for my card here, that is no good,
and I am left with the one option of the font tag…
or…wait… this works too
ha-markdown $: |
h3 { color: #152b81; }
b {color: #152b81; }
apparently we can use the b
from the <b>
tag there too, probably any tag then?
FYI a complete card with stylings
type: entities
title: Vooruitzichten
card_mod:
class: class-header-margin-no-color
style: |
.card-header {
background: rgb(226,239,248);
color: rgb(21,43,129);
}
entities:
#buienradar dark color #152b81 rgb(21,43,129)
#buienradar light color #e2eff8 rgb(226,239,248)
- type: custom:hui-element
card_type: markdown
<<: &style
card_mod:
style:
.: |
ha-card.type-markdown {
margin: 0 -16px;
box-shadow: none;
}
ha-markdown $: |
h3 {color: #152b81;}
b {color: #152b81;}
# things like h4 { font-family: “Helvetica, sans-serif”; font-size: 24px; color: #152b81; }
content: >
<h3>Korte termijn</h3>
<p>{{state_attr('sensor.buienradar_korte_termijn','forecast')}}</p>
{% from 'easy_time.jinja' import month %}
{% set kort = 'sensor.buienradar_korte_termijn' %}
{% set van = state_attr(kort,'startdate')|as_datetime %}
{% set tot = state_attr(kort,'enddate')|as_datetime %}
Geldig van <b>{{van.day}} {{month(van)}}</b> tot <b>{{tot.day}} {{month(tot)}}</b>
- type: divider
- type: custom:hui-element
card_type: markdown
<<: *style
content: >
<h3>Lange termijn</h3>
<p>{{state_attr('sensor.buienradar_lange_termijn','forecast')}}</p>
{% from 'easy_time.jinja' import month %}
{% set lang = 'sensor.buienradar_lange_termijn' %}
{% set van = state_attr(lang,'startdate')|as_datetime %}
{% set tot = state_attr(lang,'enddate')|as_datetime %}
Geldig van <b>{{van.day}} {{month(van)}}</b> tot <b>{{tot.day}} {{month(tot)}}</font>
- type: divider
- type: custom:hui-element
card_type: markdown
<<: *style
content: >
{% set datum =
state_attr('sensor.buienradar_weerbericht','published')|as_datetime %}
{% from 'easy_time.jinja' import weekday, month %}
{% set gepubliceerd =
weekday(datum) ~' '~datum.day~' '~month(datum)~' om '~datum.strftime('%H:%M') %}
<h3>Vooruitzicht van {{gepubliceerd}}</h3>
<h3>Samenvatting:</h3>
<p>{{state_attr('sensor.buienradar_weerbericht','summary')}}</p>
- type: custom:fold-entity-row
card_mod: !include /config/dashboard/card_mods/scroll_fold.yaml
head:
type: section
label: Uitgebreid
card_mod: #mimic html font <h3>
style: |
.label {
color: rgb(21,43,129) !important;
font-size: 1.17em;
font-weight: 700 !important;
margin-left: 0px !important;
}
entities:
- type: custom:hui-element
card_type: markdown
<<: *style
content: >
{% set datum =
state_attr('sensor.buienradar_weerbericht','published')|as_datetime %}
{% from 'easy_time.jinja' import weekday, month %}
{% set gepubliceerd =
weekday(datum) ~' '~datum.day~' '~month(datum)~' om '~datum.strftime('%H:%M') %}
<!--- <h3>Uitgebreid:</h3> -->
<p>{{state_attr('sensor.buienradar_weerbericht','text')}}</p>
Gepubliceerd op: <b>{{gepubliceerd}}</b>