question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS fill doesn't work

See original GitHub issue

Hi to everybody. I’m not able anymore to change the fill color of the SVG object. I’m able via CSS to modify the visibility and the opacity but noway for the color.

Here is the CSS part:

.light-on {
  fill: red !important;
}

.light-off {
  fill: white !important;
}

and the YAML part:

    - entities:
        - switch.twinkly
        - light.wled
      state_action:
        action: call-service
        service: floorplan.class_set
        service_data: '${(entity.state === "on") ? "light-on" : "light-off" }'
      tap_action:
        action: call-service
        service: homeassistant.toggle

The YAML part is correct and object are well named infact , changing the CSS to:

.light-on {
  opacity: 1 !important;
}

.light-off {
  opacity: 0.2 !important;
}

it works correctly.

Any suggestion on how to solve it?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

2reactions
OzGavcommented, Jan 27, 2021

I know this has been closed but just talking to Petar this is a change to the underlying way floorplan works. For those in the future that find this you can try changing your CSS from what might have been something like:

.lamp-off {
  stroke: #000000 !important;
  opacity: 0.5 !important;
  stroke-opacity: 0 !important;
}

.lamp-on {
  stroke: #03A9F4 !important;
  opacity: 1 !important;
  stroke-opacity: 1 !important;
}

to

.lamp-off, .lamp-off *  {
  stroke: #000000 !important;
  opacity: 0.5 !important;
  stroke-opacity: 0 !important;
}

.lamp-on, .lamp-on * {
  stroke: #03A9F4 !important;
  opacity: 1 !important;
  stroke-opacity: 1 !important;
}

note the extra in the first line which will apply the style to all nested elements.

0reactions
pkozulcommented, Jan 27, 2021

Thanks @OzGav

Yep, the old version of Floorplan automatically ‘drilled down’ into nested elements and applied the specified CSS styles. We thought this would not always be desirable for all users / cases, so the new version no longer does this.

As Gav mentioned, you can use selectors in your CSS rules to control exactly which nested elements get which styles applied to them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG Fill Color Not Working
Your path has inline css on it with fill. This overrides your other css. Can be fixed with !important. Or you could remove...
Read more >
Applying fill color to SVG doesn't work - Oxygen XML Forum
It works in HTML. I generate an HTML file with one CSS file, then clone the HTML and apply my print CSS. The...
Read more >
fill | CSS-Tricks
The fill property in CSS is for filling in the color of a SVG shape.
Read more >
CSS : SVG Fill Color Not Working - YouTube
CSS : SVG Fill Color Not Working. Watch later. Share. Copy link. Info. Shopping. Tap to unmute. If playback doesn't begin shortly, ...
Read more >
Fills and Strokes - SVG: Scalable Vector Graphics | MDN
There are several ways to color shapes (including specifying attributes on the object) using inline CSS, an embedded CSS section, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found