Dark mode only custom theme

Hi
Currently, Home Assistant assumes that if a theme defines section modes:, it does support both modes. According to the documentation, this shouldn’t be the case:

Since this example theme only has a dark mode defined, this mode will automatically be used.

This is a problem because I would like to base my dark-only theme on the default dark mode, but that’s currently impossible. My only workaround is to not define a modes: section, and then the frontend will base the colors of my theme on the light mode, and also use wrong color-scheme CSS property

Here’s a current behavior:

  • Frontend assumes that if modes: is defined, theme supports mode selection, even if only one mode is actually available

  • Backend allows set_theme action to contain mode: light, even when only dark mode is defined

Here’s an expected behavior:

  • Frontend doesn’t show mode selection if only one mode is actually defined by the theme. It should use the only available mode
  • Backend doesn’t allow to set a mode that is not defined by the theme

I would submit this issue to Github, but not sure which repository to choose to since it depends on both the frontend and the backend