Code Monkey home page Code Monkey logo

lovelace-soft-ui's Introduction

Lovelace Soft UI

Soft UI light/dark screenshots

Overview

This project originally stemmed from just me redoing my UI. However, it has evolved into something much bigger. Today, in this repo, you will find detailed instructions on applying this style to your cards and a collection of custom-configured cards that match best with this style.

This would have not been possible without the support of the Home Assistant community. If you need help, please consult the community forums or the issues tab. New contributions are most welcomed. Thank you, and please check out other great alternatives:

Installation

First, we will need card-mod to style our cards. The easiest way to install card-mod is via HACS.

Second, we will need to apply our card-mod style through themes. We first need to install custom themes (can also be found via HACS), then we will add our card-mod style to the theme YAML files, typically found at: config/themes/{theme_name}/{theme_name}.yaml

There are two ways to style our cards: the Universal method, which styles all cards, and the Individual method, which only styles specific cards.

Universal

To universally style all cards, add the following to your theme YAML file:

Show code

Light version:

# Example light_theme.yaml entry
theme_name:
  card-mod-theme: theme_name # Change to your theme name
  card-mod-card: |
    ha-card {
      margin: 20px;
      border-radius: 15px;
      background-color: var(--primary-background-color);
      box-shadow: -5px -5px 15px #ffffff, 5px 5px 15px #ebebeb;
    }
  # This is needed for the "pressed" buttons
  soft-ui-pressed: 'inset -4px -4px 5px #ffffff, inset 4px 4px 5px #ebebeb'

Dark version:

# Example dark_theme.yaml entry
theme_name:
  card-mod-theme: theme_name # Change to your theme name
  card-mod-card: |
    ha-card {
      margin: 20px;
      border-radius: 15px;
      background-color: var(--primary-background-color);
      box-shadow: -5px -5px 15px #2c2c2c, 5px 5px 15px #191919;
    }
  # This is needed for the "pressed" buttons
  soft-ui-pressed: 'inset -4px -4px 5px #2c2c2c, inset 4px 4px 5px #191919'

Individual

To individually style cards, first, we will create a styling class in our theme YAML:

Show code

Light version:

# Example light_theme.yaml entry
theme_name:
  card-mod-theme: theme_name # Change to your theme name
  card-mod-card: |
    ha-card.soft-ui {
      margin: 20px;
      border-radius: 15px;
      background-color: var(--primary-background-color);
      box-shadow: -5px -5px 15px #ffffff, 5px 5px 15px #ebebeb;
    }
  # This is needed for the "pressed" buttons
  soft-ui-pressed: 'inset -4px -4px 5px #ffffff, inset 4px 4px 5px #ebebeb'

Dark version:

# Example dark_theme.yaml entry
theme_name:
  card-mod-theme: theme_name # Change to your theme name
  card-mod-card: |
    ha-card.soft-ui {
      margin: 20px;
      border-radius: 15px;
      background-color: var(--primary-background-color);
      box-shadow: -5px -5px 15px #2c2c2c, 5px 5px 15px #191919;
    }
  # This is needed for the "pressed" buttons
  soft-ui-pressed: 'inset -4px -4px 5px #2c2c2c, inset 4px 4px 5px #191919'

Then to use the style, simply reference the soft-ui class in any card by adding the following to the YAML card configuration:

# Example card configuration entry
card_mod:
  class: soft-ui

Cards

All cards below have been made to work with both the Universal styling method and the Individual styling method. However, Button cards require the additional installation of the custom button-card. Add cards via the Manual card option in the Lovelace UI.

Heading

Get card here

Heading card

Heading & Subheading

Get card here

Heading subheading card

Button

Get card here

Button card

Button Border

Get card here

Button border card

Button Text

Get card here

Button text card

Button Border Text

Get card here

Button border text card

Button Description

Get card here

Button description card

lovelace-soft-ui's People

Contributors

adr29truck avatar erjanmx avatar imgbot[bot] avatar imgbotapp avatar ktibow avatar qiz-li avatar ronspawnson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lovelace-soft-ui's Issues

improvement request

hi, your work is amazing but is kinda difficult to restart from scratch to get a new nice ui..

i was thinking about implementing this look on a theme, do you think that is possible?

would be really nice and very convinient

Incompatibility with HA 0.113.0

After updating to v0.113.0, the background of the card is showing for some reason.

image

content: |
  # Bedroom
style:
  .: |
    ha-card {
      --paper-card-background-color: none !important;
      box-shadow: none !important;
    }
  ha-markdown:
    $: |
      h1 {
        font-size: 20px;
        font-weight: bold;
        font-family: Helvetica;
        letter-spacing: '-0.01em';
      }
type: markdown

Style not applied when used in decluttering card

I experience a weird behaviour.
I'm using decluttering-card to onboard all the style code of each custom-button, but it seems the style is not applied, and no button appears.
I put few buttons in an horizontal-stack.

Thus, when I add one more button without using decluttering card, suddenly everything appears!
It looks like some weird cache or something like that.

Code to reproduce:


decluttering_templates:
  button_soft:
    card:
      entity: '[[entity]]'
      hold_action:
        haptic: medium
      show_icon: true
      show_name: false
      state:
        - styles:
            icon:
              - color: 'var(--paper-item-icon-active-color)  '
          value: 'on'
      style: |
        ha-card {
          margin: 5px;  
          margin-left: 6.5px;
          box-shadow: 
           {% if is_state('sun.sun', 'above_horizon') and is_state('[[entity]]', 'on') %}
             inset -4px -4px 8px 0 rgba(255,255,255,.5), inset 4px 4px 8px 0 rgba(0,0,0,.03);
           {% elif is_state('sun.sun', 'above_horizon') and is_state('[[entity]]', 'off') %}                      
             -5px -5px 8px 0 rgba(255,255,255,.5),5px 5px 8px 0 rgba(0,0,0,.03);
           {% elif is_state('sun.sun', 'below_horizon') and is_state('[[entity]]', 'on') %}                      
             inset -4px -4px 10px 0 rgba(50, 50, 50,.5), inset 4px 4px 12px 0 rgba(0,0,0,.3); 
           {% elif is_state('sun.sun', 'below_horizon') and is_state('[[entity]]', 'off') %}   
             -5px -5px 8px 0 rgba(50, 50, 50,.5),5px 5px 8px 0 rgba(0,0,0,.15);
           {% elif is_state('sun.sun', 'above_horizon') %}   
             -5px -5px 8px 0 rgba(255,255,255,.5),5px 5px 8px 0 rgba(0,0,0,.03);
           {% elif is_state('sun.sun', 'below_horizon') %}   
             -5px -5px 8px 0 rgba(50, 50, 50,.5),5px 5px 8px 0 rgba(0,0,0,.15);
           {% endif %}                      
        }
        @media only screen and (max-width: 600px) {
           ha-card {
             margin: 3px; 
             margin-left: 4px;                   
           }
        }
        @media only screen and (min-width: 1200px) {
           ha-card {
             margin: 8px;  
             margin-left: 11px;               
           }
        }
      styles:
        card:
          - width: 60px
          - height: 60px
          - border-radius: 15px
          - background-color: var(--primary-background-color)
        icon:
          - color: var(--primary-text-color)
      type: 'custom:button-card'
cards:
  - template: button_soft
    type: 'custom:decluttering-card'
    variables:
      - entity: group.living_lights
  - template: button_soft
    type: 'custom:decluttering-card'
    variables:
      - entity: light.fibaro_system_fgd212_dimmer_2_level_7
  - template: button_soft
    type: 'custom:decluttering-card'
    variables:
      - entity: light.fibaro_system_fgd212_dimmer_2_level_4
  - template: button_soft
    type: 'custom:decluttering-card'
    variables:
      - entity: light.fibaro_system_fgd212_dimmer_2_level_5
  - template: button_soft
    type: 'custom:decluttering-card'
    variables:
      - entity: switch.prise_bambi
  - entity: light.fibaro_system_fgd212_dimmer_2_level_4
    hold_action:
      haptic: medium
    show_icon: true
    show_name: false
    state:
      - styles:
          icon:
            - color: 'var(--paper-item-icon-active-color)  '
        value: 'on'
    style: |
      ha-card {
        margin: 5px;  
        margin-left: 6.5px;
        box-shadow: 
         {% if is_state('sun.sun', 'above_horizon') and is_state('[[entity]]', 'on') %}
           inset -4px -4px 8px 0 rgba(255,255,255,.5), inset 4px 4px 8px 0 rgba(0,0,0,.03);
         {% elif is_state('sun.sun', 'above_horizon') and is_state('[[entity]]', 'off') %}                      
           -5px -5px 8px 0 rgba(255,255,255,.5),5px 5px 8px 0 rgba(0,0,0,.03);
         {% elif is_state('sun.sun', 'below_horizon') and is_state('[[entity]]', 'on') %}                      
           inset -4px -4px 10px 0 rgba(50, 50, 50,.5), inset 4px 4px 12px 0 rgba(0,0,0,.3); 
         {% elif is_state('sun.sun', 'below_horizon') and is_state('[[entity]]', 'off') %}   
           -5px -5px 8px 0 rgba(50, 50, 50,.5),5px 5px 8px 0 rgba(0,0,0,.15);
         {% elif is_state('sun.sun', 'above_horizon') %}   
           -5px -5px 8px 0 rgba(255,255,255,.5),5px 5px 8px 0 rgba(0,0,0,.03);
         {% elif is_state('sun.sun', 'below_horizon') %}   
           -5px -5px 8px 0 rgba(50, 50, 50,.5),5px 5px 8px 0 rgba(0,0,0,.15);
         {% endif %}                      
      }
      @media only screen and (max-width: 600px) {
         ha-card {
           margin: 3px; 
           margin-left: 4px;                   
         }
      }
      @media only screen and (min-width: 1200px) {
         ha-card {
           margin: 8px;  
           margin-left: 11px;               
         }
      }
    styles:
      card:
        - width: 60px
        - height: 60px
        - border-radius: 15px
        - background-color: var(--primary-background-color)
      icon:
        - color: var(--primary-text-color)
    type: 'custom:button-card'
type: horizontal-stack

Alignment broken in 0.117

There are changes in 0.117 which makes the alignment of the secondary text in vertical buttons broken.

image

Theme shadow issues

Trying it out for the first time, and while it looks great with the Slate theme, with the Clear theme it doesn't look anywhere like in the pics. I just copy pasted the buttons from the docs

image

Request to fix GitHub Pages

Describe the problem
Basically, when you go to n-l1.github.io/lovelace-soft-ui, right now you get a blank page.

To Fix
Steps to fix the behavior:

  1. Go to docs
  2. Click on index.html
  3. Click on the trash can
  4. Confirm the commit
  5. Go to the Settings
  6. Scroll down to GitHub Pages
  7. Click on the Source dropdown
  8. Choose master branch
  9. You're done! Now consider setting the URL of this repo to https://n-l1.github.io/lovelace-soft-ui/. There's an edit button next to the description on the main page.

Spacing between custom button cards

I am using the soft ui with a custom button card integrated in a grid card. However, there is too much spacing in between the buttons and I would like shorten the distance between the buttons. How do I do that?

image

Resolution issues

Hey, awesome style! I have a problem with resolutions though. My GF have a Samsung Galaxy S10e with a smaller display and you can see for yourself that the buttons get cropped. Is there any way around this? I'm no expert in with styling so I'm not sure what I can do.

https://imgur.com/a/T0Vixpr

Font Size Problem in Vertical Buttons Card

Hi

thanks for this nice template!

I got an issue where the font size is not applied to the h1 text in the vertical buttons card. Both, the the upper text (supposed to be 20px) and the smaller text (supposed to be 15 px) have 28px, which is a default I guess. Tested with firefox and chromium. Also the font is Roboto, not Helvetica.
snippet

I am not sure where the problem is. Apparently the style is not directly applied to ha-card, but is a card-mod element on the same html level:
snippet

latest button-card.js and card-mod.js is installed.

corresponding yaml code:

              - content: >
                  # There are  {% if is_state('sensor.lights_on', '0') %}
                  currently no  {% else %}  {{states('sensor.lights_on')}}  {%
                  endif %} lights on
                style: |
                  ha-card {
                  --paper-card-background-color: 'rgba(11, 11, 11, 0.00)';
                  box-shadow: 2px 2px rgba(0,0,0,0.0);
                     }
                  h1 {
                    font-size: 15px;
                    font-weight: thin;
                    font-family: Helvetica;
                    letter-spacing: '-0.01em';
                  }
                type: markdown

Custom header deprecated as of 0.116

The readme has a section on the custom header component.

Unfortunately this project is no longer maintained and may cause issues in Home Assistant versions 0.117+

Very slow

Hi is very sexy indeed. For now i started from scratch with one button only and it s very slow..

views:

  • title: Maison
    path: maison
    badges: []
    cards: null
    entity: light.lumiere_pierre
    icon: 'mdi:lamp'
    show_icon: true
    show_name: false
    styles:
    card:
    - width: 60px
    - height: 60px
    - margin: 10px
    - border-radius: 15px
    - box-shadow: >
    [[[ return states['sun.sun'].state == 'below_horizon'

        ? '-5px -5px 8px rgba(50, 50, 50, .2), 5px 5px 8px rgba(0, 0, 0,
        .08)'
    
        : '-4px -4px 8px rgba(255, 255, 255, .5), 5px 5px 8px rgba(0, 0, 0,
        .03)';
    
        ]]]
    - background-color: var(--primary-background-color)
    

    icon:
    - color: var(--primary-text-color)
    state:

    • value: 'on'
      styles:
      card:
      - box-shadow: >
      [[[ return states['sun.sun'].state == 'below_horizon'

          ? 'inset -3px -3px 5px rgba(50, 50, 50, .5), inset 3px 3px 5px
          rgba(0, 0, 0, .3)'
      
          : 'inset -3px -3px 5px rgba(255, 255, 255, .65), inset 3px 3px
          5px rgba(0, 0, 0, .035)';
      
          ]]]
      

      icon:
      - color: var(--paper-item-icon-active-color)
      tap_action:
      action: toggle
      haptic: light
      hold_action:
      action: more-info
      haptic: medium
      type: 'custom:button-card'

Icons not centered in IOS App

When using the theme with custom button styles, the icons are aligned at the top of the buttons.
It works, though, on any browser, even safari...

Must be something very specific with the web rendering of the IOS App.

Some screenshots here. I use the default style from the readme.
Browser vs App

image
image
image
image

Theme not updating correctly with Chrome in dark mode

Hi,
I have dark theme set for Windows and as such, Chrome is always in dark mode. I have set the automation mentioned in the setup to switch between the light and dark themes depending on the sun's position. However, during the day, light theme is not displayed correctly and is basically dark with light shadows:
image
Is there a way around this?
By the way, "Backend-selected" is selected under profile>Theme

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.