feat: support for color thresholds in forecast chart#43
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces support for temperature-based color gradients in forecast chart mode, allowing temperature lines to dynamically transition through different colors based on temperature values. The feature is opt-in via a new use_color_thresholds configuration option.
- Adds gradient coloring for temperature lines with predefined thresholds at -10°, 0°, 8°, 18°, 26°, and 34° (Celsius)
- Introduces six new CSS variables for customizing temperature threshold colors (cold, freezing, chilly, mild, warm, hot)
- Implements dashed line style for low temperature when color thresholds are enabled for better visual distinction
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| src/components/wfc-forecast-chart.ts | Implements gradient computation logic and temperature line styling with threshold-based colors |
| src/types.ts | Adds use_color_thresholds boolean option to forecast configuration interface |
| src/weather-forecast-card.css | Defines six new CSS variables for temperature color thresholds with sensible defaults |
| src/editor/weather-forecast-card-editor.ts | Adds UI configuration option and helper text for the new feature |
| README.md | Documents the new feature, configuration option, and theme variables with detailed descriptions |
| demo/index.html | Enables color thresholds in the demo and adds apparent_temperature to displayed attributes |
| test/weather-forecast-chart.test.ts | Adds comprehensive test suite for gradient functionality, line styles, and CSS variable customization |
| test/mocks/test-data.ts | Adds Fahrenheit test data with conversion utility for temperature unit testing |
| test/mocks/hass.ts | Adds unit of measurement support and apparent temperature calculation to mock |
| test/app/index.html | Adds visual test cases for color thresholds in both Celsius and Fahrenheit |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Tero Roininen <troinine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for color thresholds for temperature lines in the forecast chart mode. Colors can be customized via themes. Sensible defaults are used with fixed intervals.