-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Fix visual map issues #17074
Fix visual map issues #17074
Conversation
@@ -286,7 +286,7 @@ export interface MapCardConfig extends LovelaceCardConfig { | |||
entities?: Array<EntityConfig | string>; | |||
hours_to_show?: number; | |||
geo_location_sources?: string[]; | |||
dark_mode?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change, if we are going to change this, we should at least make it backwards compatible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for that, I will fix this.
Does that radio button set need a title? |
Good questions, I didn't thought about that. I just assumed that it is clear. I will think about that and maybe I get more opinions on that. |
I got some feedback about the radio buttons that a title is preferred. (11/11 people) |
I will point out the default behavior of selector-select is radio buttons with 5 or less options, and dropdown with 6 or more. Personally I have no opinion between the two, but if the design decision was previously made that selectors with less than 6 items use radio buttons, I see no reason to override that, might as well stay consistent? Note to get the title I think all you need to do is provide a translation key for "theme_mode", but you've already used that as a group name for the modes. Maybe just rename |
I see no reason too. In the user's profile the dropdown is used multiple times with less than 6 options.
Thank you! |
@christophwen @bramkragten Thanks for working on this, it looks like this has had all the checks passed. I don't know the process but will this now make the next release ? |
No, the beta for the next release (tomorrow) started last Wednesday. We don't add new features after the beta has started, only bug fixes. This will be in the release of August. |
Thanks for the update 👍 |
src/components/map/ha-map.ts
Outdated
#map.light { | ||
background: #ffffff; | ||
color: #000000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only use hard coded colors when the map darkmode setting differs from the theme darkmode. Otherwise we should just use theme colors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #000000
is needed to show the icon of the home (house) in black, when HA is in dark mode and map should use the light theme. I will change it to --white-color
. (#ffffff
→ --black-color
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add a force flag to ha-map
, that only hardcodes colors when the mode doesnt match the theme hass.themes.darkMode
.
#map.light { | ||
background: #ffffff; | ||
color: #000000; | ||
--map-filter: invert(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this do? --map-filter: unset;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This forces the map to appear in light mode when HA is in dark mode. With --map-filter: unset;
the map stays in dark mode.
.leaflet-tile-pane { | ||
filter: var(--map-filter); | ||
} | ||
.dark .leaflet-bar a { | ||
background-color: var(--card-background-color, #1c1c1c); | ||
background-color: #1c1c1c; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, use theme if possible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed to show the +
and -
of the zoom control in black, when HA is in light theme and the map in dark mode.
@@ -94,33 +125,32 @@ export class HuiMapCardEditor extends LitElement implements LovelaceCardEditor { | |||
<ha-form | |||
.hass=${this.hass} | |||
.data=${this._config} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should migrate the old config (dark_mode) to the new config so it is displayed correctly in the form, and is saved in the new format
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we can discuss this on Discord, because right now, I am not sure what I have to do here.
Please open a documentation PR for these changes. |
Could you please explain to me what a documentation PR is, I have never created one before. Then I will do that :) |
If we're changing the options for map card, go here: https://www.home-assistant.io/dashboards/map/ Go down to the bottom of the page, click the |
Short Update: I will continue as soon as I get some answers. Then I will finish the PR and create the documentation PR as follow-up. |
Hey, I was on vacation, but now I am back. I will continue soon with this PR. |
This comment was marked as off-topic.
This comment was marked as off-topic.
Is this still progressing? The original issue #15587 had been marked as stale but the problem is still present in Home Assistant 2023.9.3 & Companion App 2023.9.2-full |
@christophwen did you get the feedback you needed to raise the PR? I know a few people are waiting for and appreciate the work you have put in so far. |
@siw1973 Sorry, I got carried away by something else. I will do my best to finish the PR. |
Check #18667, it added a class for forced dark that you should use in this PR too. |
Aren't we adding a 'Lite' mode map, even when the Home Assistant theme is set to 'Dark' mode? (basically so the map can actually be seen clearly) |
yes we need a way to force "light" mode, not dark mode |
We need both. |
- hover background color of zoom control in dark mode - map light mode when dark theme is used - background color of zoom control with map dark mode when light theme is used
- Additionally fixed unpleasant horizontal scrollbar in map editor
772ef8a
to
c45b621
Compare
I rebased and added the class. (+ 'force-light') |
@@ -159,6 +159,7 @@ export class HaMap extends ReactiveElement { | |||
const map = this.shadowRoot!.getElementById("map"); | |||
map!.classList.toggle("dark", darkMode); | |||
map!.classList.toggle("forced-dark", this.darkMode); | |||
map!.classList.toggle("foced-light", !darkMode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forced-light
should only be set when this.darkMode === false
otherwise it will also add the forced class when then theme is actually light mode. forced
here means the map dark mode is different than the dark mode of the theme.
Imho the dark_mode option should (kind of a FR): |
There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. |
This is a real shame as this has had some work done on it, but seems to have been bogged down by a lack of understanding on process and clarity as to what the next steps need to be. If this could be resurected and dragged over the line then it would be really helpful to a few people linked to this issue and also I expect many other people who just don't use GitHub. |
@christophwen - If you have no intention of returning to this in the near future, I will push some changes that I think can bring this to completion. If you don't want me to make edits to your branch, please state your objection, otherwise I will do so in a few days. |
@karwosts it would be great if you make changes to get this done. My free time is very limited right now and I am not the best with CSS changes. Thank you :) |
Hmm I thought I would be able to push to this from the CLI, but I'm getting 403 authorization problems whatever I try to do.
(Maybe I should have cloned the upstream PR branch instead of your repo's branch? not exactly sure) Unless I get that figured out I just spawned a new PR at #20541 with these changes and fixes to get around the 403 problem. |
The duplicate PR was merged. Thanks @christophwen |
@karwosts thanks for finishing! |
Breaking change
Proposed change
This PR contains multiple fixes for different visual issues with the map (card).
This summery shows how the map's look with all possible configurations:
Type of change
Example configuration
Additional information
dark_mode
withtheme_mode
home-assistant.io#32352Checklist
If user exposed functionality or configuration variables are added/changed: