-
Notifications
You must be signed in to change notification settings - Fork 617
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 Color Definitions to ColorSchema Enum (HeatMap) (from #4283) #4306
Add Color Definitions to ColorSchema Enum (HeatMap) (from #4283) #4306
Conversation
96be74f
to
2c62483
Compare
4b16faa
to
6e5e0a4
Compare
Updated the YELLOW_WHITE_BLACK color schema to use the default background color from the theme, similar to the existing implementation in the GREEN_WHITE_RED schema. Add Color Definitions to ColorSchema Enum 1. **GREEN_YELLOW_RED**: Green for gains, Red for losses, Yellow for neutral values. 2. **GREEN_WHITE_RED**: Green for gains, White for neutral, Red for losses. 3. **GREEN_RED_GREY**: Green for gains, Red for losses, Grey for neutral. 4. **BLUE_ORANGE_GREY**: Blue for stable values, Orange for volatile values, Grey for neutral. 5. **BLACK_YELLOW_WHITE**: Black for extreme gains, Yellow for moderate returns, White for neutral. The colors are obtained from colors.java Pull Request: Refactoring of the ColorSchema Enum Class GREEN_RED_GREY has been renamed to GREEN_GRAY_RED BLUE_ORANGE_GREY has been renamed to BLUE_GRAY_ORANGE BLACK_YELLOW_WHITE has been renamed to YELLOW_WHITE_BLACK. Updating Documentation Update GREEN_WHITE_RED Color Schema and Improve Interpolation Method Modified the GREEN_WHITE_RED color schema to interpolate with the default background color from the theme using Colors.theme().defaultBackground().getRGB(). This change improves visual appearance in dark themes and enhances overall UI consistency. Updated the interpolate method to clamp the factor parameter between 0 and 1. This ensures that the method handles out-of-bounds values properly, preventing unexpected results and invalid RGB values. Enhances the color interpolation logic GREEN_WHITE_RED Added a transition to yellow for performance values over 0.6, improving the gradient from green to yellow. YELLOW_WHITE_BLACK Implemented a transition from yellow to black for values above 0.6 for better visibility of high performance. Optimize Color Normalization and Interpolation Logic GREEN_WHITE_RED Color Schema: Adjusted the transition to yellow to occur earlier (from 0.6 to 0.4), allowing for a smoother gradient. Used -p for negative performance values to ensure a proper mapping to red. Modified GREEN_GRAY_RED Color Schema: Incorporated the use of -p to correctly interpolate colors for negative performance values. Refined BLUE_GRAY_ORANGE Color Schema: Updated the interpolation for negative performance values to use -p, enhancing color representation.
8b3507a
to
c4def80
Compare
color = Colors.interpolate(Colors.theme().defaultBackground().getRGB(), Colors.RED.getRGB(), | ||
(float) -p); |
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.
By using -p
all negative values will be white (= the color of the background) because the interpolate
function clamps the value between 0 and 1 (and p is always between 0 and 1)
1. **GREEN_YELLOW_RED**: Green for gains, Red for losses, Yellow for neutral values. 2. **GREEN_WHITE_RED**: Green for gains, White for neutral, Red for losses. 3. **GREEN_GRAY_RED**: Green for gains, Red for losses, Grey for neutral. 4. **BLUE_GRAY_ORANGE**: Blue for stable values, Orange for volatile values, Grey for neutral. 5. **BLACK_WHITE_YELLOW**: Black for extreme gains, Yellow for moderate returns, White for neutral. Updated the interpolate method to clamp the factor parameter between 0 and 1. This ensures that the method handles out-of-bounds values properly, preventing unexpected results and invalid RGB values. Issue: #4306
Merged. I have refactored the creation of the gradients into a separate class. And used multiple color points in order to increase the fidelity of the colors (for example, always interpolating between green and gray makes the lighter greens "dirty"). See 7ea526e @Nirus2000 We can:
You had an example somewhere (but I cannot find it anymore). How do they handle dark/light mode? |
Hello @buchen |
Add Color Definitions to ColorSchema Enum
Sorry... Reopen this... i kill my fork :-(
#4283