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

Add css var for meta theme-color attribute #20558

Merged
merged 2 commits into from
Apr 22, 2024

Conversation

Nicooow
Copy link
Contributor

@Nicooow Nicooow commented Apr 19, 2024

Proposed change

Previously, it wasn't possible to specifically change the color of the "theme-color" meta tag, which is used on some browsers to color the top bar, or on mobile devices.

<meta name="theme-color" content="#4285f4" />

The only way was to modify app-header-background-color, which also modified the bar at the top of the page, rendering an ugly result.
In addition, the tag was correctly updated in light mode, but in dark mode it reverted to blue, regardless of the primary-color, which was also ugly.

I added app-theme-color to specifically modify this tag, and it inherits primary-color by default to keep the same behavior as before, fixing forced blue in dark mode.

Before, with red primary color :
Capture d'écran 2024-04-19 230806

Capture d'écran 2024-04-19 225612

After:
Capture d'écran 2024-04-19 230822

Capture d'écran 2024-04-19 225643

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

frontend:
  themes:
    dev:
      modes:
        light:
          primary-color: "#D23232"
          accent-color: orange
        dark:
          app-header-background-color: "#ff0000"
          app-theme-color: "#00ff00"
          primary-color: "#D23232"
          accent-color: orange

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue or discussion:
  • Link to documentation pull request:

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:

home-assistant[bot]

This comment was marked as outdated.

@home-assistant home-assistant bot marked this pull request as draft April 19, 2024 21:05
@home-assistant

This comment was marked as outdated.

@Nicooow Nicooow marked this pull request as ready for review April 20, 2024 10:58
@bramkragten bramkragten merged commit 7ecf8b7 into home-assistant:dev Apr 22, 2024
13 checks passed
@TheJulianJES
Copy link
Member

This seems to have caused a regression on Chrome PWAs when using the dark theme:

previous, correct behavior:
Bildschirmfoto 2024-04-26 um 01 35 27

new behavior (2024.5.0b0):
Bildschirmfoto 2024-04-26 um 01 35 42

@Nicooow
Copy link
Contributor Author

Nicooow commented Apr 26, 2024

This seems to have caused a regression on Chrome PWAs when using the dark theme:

previous, correct behavior: Bildschirmfoto 2024-04-26 um 01 35 27

new behavior (2024.5.0b0): Bildschirmfoto 2024-04-26 um 01 35 42

Can you please screen the previous behavior in light mode please ?

Perhaps we could default dark themes to the same “darker” color as the bar below.

@TheJulianJES
Copy link
Member

Can you please screen the previous behavior in light mode please ?

It's the same color for the title bar and the "HA bar", as expected. That behavior is unchanged.

Only the dark theme behavior is "broken" now. Also seen when just opening the mobile page on iOS with a dark theme -- the status bar becomes light blue (instead of having the same color as the HA bar like before).

@Nicooow Nicooow mentioned this pull request Apr 30, 2024
9 tasks
@Nicooow
Copy link
Contributor Author

Nicooow commented Apr 30, 2024

Can you please screen the previous behavior in light mode please ?

It's the same color for the title bar and the "HA bar", as expected. That behavior is unchanged.

Only the dark theme behavior is "broken" now. Also seen when just opening the mobile page on iOS with a dark theme -- the status bar becomes light blue (instead of having the same color as the HA bar like before).

Should be fixed : #20671

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

Successfully merging this pull request may close these issues.

3 participants