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

Handle short form hex colors in conversion functions #24642

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

karwosts
Copy link
Contributor

@karwosts karwosts commented Mar 15, 2025

Proposed change

Some themes use short form hex codes like #F00, but our color converters don't understand this for things like graph colors and energy dashboard.

We can handle this by converting to long form in the theme conversion function.

Also update to strip alpha codes from hex colors, in case some people accidentally use them (similar to how we already ignore for rgba()). The only use of this function is currently in graph cards where alpha channel is always manually manipulated, so we don't want it. If some other use comes up in the future, we could modify the function with an optional parameter to keep or toss the alpha.

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

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:

@karwosts karwosts marked this pull request as draft March 15, 2025 15:11
@karwosts karwosts marked this pull request as ready for review March 15, 2025 15:21
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.

Energy: Wrong color in device chart
1 participant