Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to achieve glow effect? #110

Open
macbih opened this issue Dec 15, 2022 · 2 comments
Open

How to achieve glow effect? #110

macbih opened this issue Dec 15, 2022 · 2 comments

Comments

@macbih
Copy link

macbih commented Dec 15, 2022

I am trying to implement a glow effect which perfectly works with the Button Card (source see here).

# Button Card syntax
state:
  - value: 'on'
    styles:
      card:
        - '-webkit-box-shadow': 0 0 0.95rem 0.2rem var(--button-card-light-color)
        - box-shadow: 0 0 0.95rem 0.2rem var(--button-card-light-color)
        - transition: all 2s ease

So far, I was not able to transfer it to the Paper Buttons Row to achieve the same glow effect. For example, this base_config does not work:

    base_config:
      preset: mushroom
      state_styles:
        'on':
          button:
            '-webkit-box-shadow': 0 0 0.95rem 0.2rem var(--button-card-light-color)
            box-shadow: 0 0 0.95rem 0.2rem var(--button-card-light-color)
            transition: all 2s ease

Can someone help me with this, please?

@jcwillox
Copy link
Owner

the css variable --button-card-light-color is only available when using button-card, so you need to use the equivalent of paper-buttons which is rgb(var(--pbs-button-rgb-state-color)) or rgb(var(--pbs-button-rgb-active-color))

    base_config:
      preset: mushroom
      state_styles:
        'on':
          button:
            '-webkit-box-shadow': 0 0 0.95rem 0.2rem rgb(var(--pbs-button-rgb-state-color))
            box-shadow: 0 0 0.95rem 0.2rem rgb(var(--pbs-button-rgb-state-color))
            transition: all 2s ease

@macbih
Copy link
Author

macbih commented Dec 17, 2022

Thank you very much, Josh @jcwillox! That works perfectly! And also thanks for the CSS explanation!

Can you please add a short example how to implement this as a preset for the raw configuration editor? Unfortunately, I am not able to get this working as well (while other presets for the button card do work).

paper_buttons_row:

  presets:

    lamp:
      preset: mushroom
      ???

Just putting the state_styles section into there does not seem to be sufficient. I am using it this way:

type: entities
show_header_toggle: false
entities:
  - type: custom:paper-buttons-row
    preset: lamp
    buttons:
      - entity: light.xyz
        layout: icon
        icon: mdi:power
      - entity: ...

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants