"Dark" theme, or "night" mode/theme

I’m trying to change the theme with an input_select but i cant make it work. When i change the input the state variable changes but the theme never gets loaded.

My code is:

    name: Escolha um tema
     - Escuro - Azul
     - Claro - Laranja
    initial: Escuro - Azul
    icon: mdi:nintendo-switch

- alias: 'Temas'
    - platform: state
      entity_id: input_select.escolha_tema
    - platform: time
      minutes: '/1'
      seconds: 10
    - service: frontend.set_theme
        name_template: >
          {% if is_state("input_select.escolha_tema", "Escuro - Azul") %}
          {%-elif is_state("input_select.escolha_tema", "Claro - Laranja") %}
          {% endif %}

I’ve tried using frontend.reload_themes instead of frontend.set_theme but no luck. Does anyone knows the soluction for this??

Thank you!

You have to select it from the configuration panel

This will help:

Is it possible to have themes change automatically?

When I wake up before dawn it would be great to have the dark theme so my eyeballs aren’t burnt by the phone glare before I wake up properly. But after dawn the theme should go back to white background.

@j.assuncao, @bachoo786, @forsquirel, @DPB61: Here is my automation rule, based on changing an input select box manually and/or automatically. There are of course other ways of accomplishing this, but this works fine for me (and is pretty comprehensible).

Please note however that changing the theme in your configuration frontend UI overrides all of it. So better leave the frontend config (https://your.home.assistant/config/core) theme set to ‘backend-selected’.

  themes: !include configuration_themes.yaml # your themes go in this file, or directly below here

    name: Choose template
     - default
     - day
     - night
    initial: day
    icon: mdi:theme-light-dark

  # IF: { input_select hass_template is changed by user OR home assistants boots up } THEN: { set theme to state given by input_select.hass_template }
  - id: switch_hass_template
    alias: switch_hass_template
      - platform: state
        entity_id: input_select.hass_template
      - platform: homeassistant
        event: start
      - service: frontend.set_theme
          name: "{{ states.input_select.hass_template.state }}"

  # IF: { sun.sun goes under horizon } THEN: { set theme to night mode }
  - id: day_to_night_theme
    alias: day_to_night_theme
      - platform: state
        entity_id: sun.sun
        from: 'above_horizon'
        to: 'below_horizon'
      - service: input_select.select_option
          entity_id: input_select.hass_template
          option: 'night'

  # IF: { sun.sun is up } THEN: { set theme to day mode }
  - id: night_to_day_theme
    alias: night_to_day_theme
      - platform: state
        entity_id: sun.sun
        from: 'below_horizon'
        to: 'above_horizon'
      - service: input_select.select_option
          entity_id: input_select.hass_template
          option: 'day'

2 posts were merged into an existing topic: Another Dark Theme

5 posts were split to a new topic: Another Dark Theme

when you enable themes there’s a dropdown list under configuration > configuration.yaml scroll to the bottom.

again, select the theme you want to use to apply it.

@ahs I’ll try it this weekend and give feedback. Thank you!

Yes indeed much more elegant solution. I will change my code aswell. Thanks

thanks a lot I managed to get it working when I select a theme.

Sorry if this is a silly question but if you change the Theme to another color how do you get back to the “normal” default colors? Is it as simple as saying

        name: 'default'`

or do I need to define the color values back to the original by defining a Theme called “default” ?

Oh yes, I see… Actually I don’t have any badges, so I forgot it in my themesetup… Thanks for letting me know :slight_smile:

2 posts were split to a new topic: Dark Cyan Theme

There’s already a ‘default’ theme selection that allows it to revert back to blue/white

These themes are bomb. Added a few to my setup. Thanks much for sharing!

1 Like

Midnight is amazing :smiley:

Hello all and thanks for all the nice themes you’ve created.

Is is possible to also increase the size of different elements, or perhaps there is a setting to magnify the whole UI by a factor of, let’s say, 1.3x?

It is possible to change also icons on the setting menu at left?

Here’s a script I use when working on groups, automations and themes so I don’t have to constantly restart HA. Just put script.reload somewhere where its easy to activate on your frontend.

      - service: automation.reload
      - service: homeassistant.reload_core_config
      - service: frontend.reload_themes