Skip to content

add state_color option to glance, button and state-icon#4854

Merged
bramkragten merged 3 commits into
home-assistant:devfrom
iantrich:state_color-option
Feb 17, 2020
Merged

add state_color option to glance, button and state-icon#4854
bramkragten merged 3 commits into
home-assistant:devfrom
iantrich:state_color-option

Conversation

@iantrich
Copy link
Copy Markdown
Member

@iantrich iantrich commented Feb 12, 2020

Breaking change

Proposed change

add state_color option to glance card and its entities, button card and state-icon element

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

type: glance
state_color: false
entities:
  - entity: light.ceiling_lights
    state_color: true
  - entity: light.ceiling_lights
type: entity-button
tap_action:
  action: toggle
hold_action:
  action: more-info
show_icon: true
show_name: true
entity: light.ceiling_lights
state_color: false
type: picture-elements
image: 'https://www.home-assistant.io/images/merchandise/shirt-frontpage.png'
elements:
  - type: state-icon
    entity: light.ceiling_lights
    state_color: false
    style:
      top: 50%
      left: 50%

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

Comment thread src/panels/lovelace/cards/hui-entity-button-card.ts Outdated
Comment thread src/panels/lovelace/cards/hui-glance-card.ts Outdated
@iantrich
Copy link
Copy Markdown
Member Author

babel doesn't seem to like the nullish coalescing. fix that or revert?

@bramkragten
Copy link
Copy Markdown
Member

Yeah it should be added to Babel, like this:
yarn add --dev @babel/plugin-proposal-nullish-coalescing-operator
https://github.com/home-assistant/home-assistant-polymer/blob/dev/build-scripts/babel.js#L36

@bramkragten
Copy link
Copy Markdown
Member

#4876

Comment thread src/panels/lovelace/cards/hui-entity-button-card.ts Outdated
@bramkragten bramkragten merged commit fb7fbf2 into home-assistant:dev Feb 17, 2020
@bramkragten
Copy link
Copy Markdown
Member

Please add documentation :-)

@bramkragten bramkragten mentioned this pull request Feb 17, 2020
@lock lock Bot locked and limited conversation to collaborators Feb 18, 2020
@iantrich iantrich deleted the state_color-option branch February 19, 2020 04:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support state_color:false to disable icon coloring based on state in all cards

4 participants