Midnight Theme

A dark theme I created yesterday, called Midnight.

43 Likes

For who likes it, this is the code. Not all things are themed properly as some elements just don’t popup in my configuration. So I made them bright green so they stand out and you can fix them if needed.

midnight:
# Main colors
primary-color: '#5294E2'                                                        # Header
accent-color: '#E45E65'                                                         # Accent color
dark-primary-color: 'var(--accent-color)'                                       # Hyperlinks                                         
light-primary-color: 'var(--accent-color)'                                      # Horizontal line in about
                                                                             
# Text colors                                                                  
primary-text-color: '#FFFFFF'                                                   # Primary text colour, here is referencing dark-primary-color
text-primary-color: 'var(--primary-text-color)'                                 # Primary text colour
secondary-text-color: '#5294E2'                                                 # For secondary titles in more info boxes etc.
disabled-text-color: '#7F848E'                                                  # Disabled text colour
label-badge-border-color: 'green'                                               # Label badge border, just a reference value   

# Background colors                                                            
primary-background-color: '#383C45'                                             # Settings background
secondary-background-color: '#383C45'                                           # Main card UI background  
divider-color: 'rgba(0, 0, 0, .12)'                                             # Divider 
  
# Table rows                                                                   
table-row-background-color: '#353840'                                           # Table row
table-row-alternative-background-color: '#3E424B'                               # Table row alternative
                                                                             
# Nav Menu                                                                   
paper-listbox-color: 'var(--primary-color)'                                     # Navigation menu selection hoover
paper-listbox-background-color: '#2E333A'                                       # Navigation menu background
paper-grey-50: 'var(--primary-text-color)'                                   
paper-grey-200: '#414A59'                                                       # Navigation menu selection
                                                                             
# Paper card                                                               
paper-card-header-color: 'var(--accent-color)'                                  # Card header text colour
paper-card-background-color: '#434954'                                          # Card background colour
paper-dialog-background-color: '#434954'                                        # Card dialog background colour
paper-item-icon-color: 'var(--primary-text-color)'                              # Icon color
paper-item-icon-active-color: '#F9C536'                                         # Icon color active
paper-item-icon_-_color: 'green'           
paper-item-selected_-_background-color: '#434954'                               # Popup item select                      
paper-tabs-selection-bar-color: 'green'

# Labels 
label-badge-red: 'var(--accent-color)'                                          # References the brand colour label badge border
label-badge-text-color: 'var(--primary-text-color)'                             # Now same as label badge border but that's a matter of taste
label-badge-background-color: '#2E333A'                                         # Same, but can also be set to transparent here

# Switches
paper-toggle-button-checked-button-color: 'var(--accent-color)'
paper-toggle-button-checked-bar-color: 'var(--accent-color)'
paper-toggle-button-checked-ink-color: 'var(--accent-color)'
paper-toggle-button-unchecked-button-color: 'var(--disabled-text-color)'
paper-toggle-button-unchecked-bar-color: 'var(--disabled-text-color)'
paper-toggle-button-unchecked-ink-color: 'var(--disabled-text-color)'  

# Sliders
paper-slider-knob-color: 'var(--accent-color)'
paper-slider-knob-start-color: 'var(--accent-color)'
paper-slider-pin-color: 'var(--accent-color)'
paper-slider-active-color: 'var(--accent-color)'
paper-slider-container-color: 'linear-gradient(var(--primary-background-color), var(--secondary-background-color)) no-repeat'
paper-slider-secondary-color: 'var(--secondary-background-color)'
paper-slider-disabled-active-color: 'var(--disabled-text-color)'
paper-slider-disabled-secondary-color: 'var(--disabled-text-color)'

# Google colors
google-red-500: '#E45E65'
google-green-500: '#39E949'
25 Likes

Hello, how do I use this template on my page? Can you explain me step by step? I just caught it today at homeassistant.

Thank you very much,
Joao Ribeiro

It’s part of the frontend component, see the docs here: https://home-assistant.io/components/frontend/
In a nutshell, the easiest way is to !include a themes.yaml file, with the contents above (from the theme).

1 Like

Love this theme already!

Hi I did this but gives an error

frontend:
  javascript_version: es5
  extra_html_url:
    - /local/custom_ui/state-card-custom-ui.html
  extra_html_url_es5:
    - /local/custom_ui/state-card-floorplan.html
  themes:
    midnight: !include theme_midnight.yaml

2018-01-26 22:12:18 ERROR (MainThread) [homeassistant.config] Invalid config for [frontend]: string value is None for dictionary value @ data[‘frontend’][‘themes’][‘midnight’][‘midnight’]. Got None. (See /config/configuration.yaml, line 173). Please check the docs at https://home-assistant.io/components/frontend/
2018-01-26 22:12:18 ERROR (MainThread) [homeassistant.setup] Setup failed for frontend: Invalid config.

Try this instead:

themes: !include theme_midnight.yaml

In my install, I’ve got a “themes.yaml” file, within it, I’ve defined several themes, like the one above. eg:

night:
...

day:
...

Hope this helps!

No indentation in the yaml file?

EDIT, yes is needed

This is my favourite theme. However it needs one little tweak. Could someone tell me which value I have to change to set the History page date chooser background to not white (as the date text is white):

1 Like

I have this in config file:

themes: !include themes.yaml

and inside themes.yaml:

darkred:
    # Main colors that can be changed
  dark-primary-color: "#c66900"
  disabled-text-color: "#545454"
  divider-color: "rgba(255, 255, 255, 0.12)"
  light-primary-color: "#e06c6c"
  paper-card-background-color: "#1d1d1d"
  paper-grey-200: "#191919"
  paper-item-icon-color: "#d3d3d3"
  paper-listbox-background-color: "#202020"
  primary-background-color: "#303030"
  primary-color: "#d32f2f"
  primary-text-color: "#cfcfcf"
  secondary-background-color: "#131313"
  sidebar-text_-_background: "#62717b"
    # Colors based on variables, see above
  paper-card-header-color: "var(--paper-item-icon-color)"
  paper-item-icon-active-color: "var(--primary-color)"
  paper-item-icon_-_color: "var(--primary-text-color)"
  paper-listbox-color: "var(--primary-text-color)"
  paper-grey-50: "var(--primary-text-color)"
  paper-slider-active-color: "var(--primary-color)"
  paper-slider-knob-color: "var(--primary-color)"
  paper-slider-knob-start-color: "var(--primary-color)"
  paper-slider-pin-color: "var(--primary-color)"
  paper-slider-secondary-color: "var(--light-primary-color)"
  paper-toggle-button-checked-ink-color: "var(--dark-primary-color)"
  paper-toggle-button-checked-button-color: "var(--primary-color)"
  paper-toggle-button-checked-bar-color: "var(--light-primary-color)"
  paper-toggle-button-unchecked-bar-color: "var(--primary-text-color)"
  secondary-text-color: "var(--primary-color)"
  table-row-background-color: "var(--paper-card-background-color)"
  table-row-alternative-background-color: "var(--sidebar-text_-_background)"
darkcyan:
    # Main colors that can be changed
  primary-color: "#00bcd4"
  disabled-text-color: "#545454"
  divider-color: "rgba(255, 255, 255, 0.12)"
  paper-card-background-color: "#4e4e4e"
  paper-grey-200: "#191919"
  paper-item-icon-color: "#d3d3d3"
  paper-listbox-background-color: "#202020"
  paper-listbox-color: "#FFFFFF"
  primary-background-color: "#303030"
  primary-text-color: "#cfcfcf"
  secondary-background-color: "#2b2b2b"
  secondary-text-color: "#04a7bc"
    # Colors based on variables, see above
  label-badge-background-color: "var(--secondary-background-color)"
  label-badge-text-color: "var(--text-primary-color)"
  paper-card-header-color: "#var(--paper-item-icon-color)"
  paper-grey-50: "var(--primary-text-color)"
  paper-item-icon-active-color: "var(--primary-color)"
  paper-item-icon_-_color: "var(--primary-text-color)"
  paper-slider-active-color: "var(--primary-color)"
  paper-slider-knob-color: "var(--primary-color)"
  paper-slider-knob-start-color: "var(--primary-color)"
  paper-slider-pin-color: "var(--primary-color)"
  paper-slider-secondary-color: "var(--light-primary-color)"
  paper-toggle-button-checked-ink-color: "var(--dark-primary-color)"
  paper-toggle-button-checked-button-color: "var(--primary-color)"
  paper-toggle-button-checked-bar-color: "var(--light-primary-color)"
  paper-toggle-button-unchecked-bar-color: "var(--primary-text-color)"

but checking the configuration i get “themes: component not found”
Where am i wrong?

Have you nested the themes config within the frontend config?

it should look like this

frontend:
  themes: !include themes.yaml
1 Like

Ok, i got it… Thanks

Anyone know the answer to my question above?

primary-text-color is the culprit, if you set it to a grey color it’ll offset and be visible.

Thanks but I was hoping to change the calendar background as I like the high contrast white text in the rest of the interface.

the background color seems to be coming from a style tag and it’s hard coded to #fff

Code:

:host {
     display:flex;flex-direction:column;height:100%;width:100%;outline:none;background:#fff;
}

Ah, ok. Thanks for looking into that. I’ll give 20% grey primary text a go as per your original suggestion.

1 Like

That’s the solution I ended up doing for now.

i have this error with this theme

invalid config for [frontend]: expected a dictionary for dictionary value @ data['frontend']['themes']['accent-color']. Got '#E45E65'
expected a dictionary for dictionary value @ data['frontend']['themes']['dark-primary-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['disabled-text-color']. Got '#7F848E'
expected a dictionary for dictionary value @ data['frontend']['themes']['divider-color']. Got 'rgba(0, 0, 0, .12)'
expected a dictionary for dictionary value @ data['frontend']['themes']['google-green-500']. Got '#39E949'
expected a dictionary for dictionary value @ data['frontend']['themes']['google-red-500']. Got '#E45E65'
expected a dictionary for dictionary value @ data['frontend']['themes']['label-badge-background-color']. Got '#2E333A'
expected a dictionary for dictionary value @ data['frontend']['themes']['label-badge-border-color']. Got 'green'
expected a dictionary for dictionary value @ data['frontend']['themes']['label-badge-red']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['label-badge-text-color']. Got 'var(--primary-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['light-primary-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['midnight']. Got None
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-card-background-color']. Got '#434954'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-card-header-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-dialog-background-color']. Got '#434954'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-grey-200']. Got '#414A59'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-grey-50']. Got 'var(--primary-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-item-icon-active-color']. Got '#F9C536'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-item-icon-color']. Got 'var(--primary-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-item-icon_-_color']. Got 'green'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-item-selected_-_background-color']. Got '#434954'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-listbox-background-color']. Got '#2E333A'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-listbox-color']. Got 'var(--primary-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-active-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-container-color']. Got 'linear-gradient(var(--primary-background-color), var(--secondary-background-color)) no-repeat'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-disabled-active-color']. Got 'var(--disabled-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-disabled-secondary-color']. Got 'var(--disabled-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-knob-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-knob-start-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-pin-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-slider-secondary-color']. Got 'var(--secondary-background-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-tabs-selection-bar-color']. Got 'green'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-toggle-button-checked-bar-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-toggle-button-checked-button-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-toggle-button-checked-ink-color']. Got 'var(--accent-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-toggle-button-unchecked-bar-color']. Got 'var(--disabled-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-toggle-button-unchecked-button-color']. Got 'var(--disabled-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['paper-toggle-button-unchecked-ink-color']. Got 'var(--disabled-text-color)'
expected a dictionary for dictionary value @ data['frontend']['themes']['primary-background-color']. Got '#383C45'
expected a dictionary for dictionary value @ data['frontend']['themes']['primary-color']. Got '#5294E2'
expected a dictionary for dictionary value @ data['frontend']['themes']['primary-text-color']. Got '#FFFFFF'
expected a dictionary for dictionary value @ data['frontend']['themes']['secondary-background-color']. Got '#383C45'
expected a dictionary for dictionary value @ data['frontend']['themes']['secondary-text-color']. Got '#5294E2'
expected a dictionary for dictionary value @ data['frontend']['themes']['table-row-alternative-background-color']. Got '#3E424B'
expected a dictionary for dictionary value @ data['frontend']['themes']['table-row-background-color']. Got '#353840'
expected a dictionary for dictionary value @ data['frontend']['themes']['text-primary-color']. Got 'var(--primary-text-color)'. (See /home/homeassistant/.homeassistant/configuration.yaml, line 24). Please check the docs at https://home-assistant.io/components/frontend/

can you help i like this theme