21 hover font color - #22
Merged
Merged
Conversation
- add white border to hover/wellpanel - change hover panel font/font-color/background color for better readability -remove "List of" prefix when more than one subgroup is in hover range -remove bullet points in hover panel and reduce space between subgroups -remove SGID from hover -use "font_color" function for labels to ensure readability when background color is bright -remove bold font
-Updated hover panels with improved color contrast
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates hover panels (graph + bubble) to improve color contrast by dynamically selecting a readable font color and adds sorting so highlighted/selected/reference-like entries appear first in the hover list.
Changes:
- Compute contrasting label/hover text colors based on point/fill color.
- Rework hover HTML generation to include inline styling (font/background colors) and sort entries so highlighted ones appear at the top.
- Adjust hover panel styling (e.g., border) in the graph module.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| R/mod_graph.R | Adds computed label font colors and rewrites hover panel HTML/styling + sorting. |
| R/mod_bubble.R | Rewrites hover panel HTML/styling + sorting to improve readability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
752
to
760
| style <- paste0( | ||
| "position:absolute; | ||
| z-index:100; pointer-events:none; background-color: rgba(", | ||
| grDevices::col2rgb(ColorBGplot())[1],",", | ||
| grDevices::col2rgb(ColorBGplot())[2],",", | ||
| grDevices::col2rgb(ColorBGplot())[3],",0.95); ", | ||
| "left:", left_px, "px; top:", top_px, "px; border: 0px;" | ||
| "left:", left_px, "px; top:", top_px, "px; | ||
| border: 1px solid #ffffff;" | ||
| ) |
| ":", | ||
| !!rlang::sym(y()), | ||
| "</br>", | ||
| tmp$text, |
Comment on lines
+779
to
+801
| background_color = dplyr::case_when( | ||
| substr(ColorPoints(),1,7) != substr(font.col, 1,7) ~ substr(font.col, 1,7), | ||
| substr(ColorPoints(),1,7) == substr(font.col, 1,7) ~ "" | ||
| ), | ||
| ) %>% | ||
| dplyr::rowwise() %>% | ||
| dplyr::mutate( | ||
| font.col2 = dplyr::case_when( | ||
| substr(ColorPoints(),1,7) != substr(font.col, 1,7) ~ font_color(font.col), | ||
| substr(ColorPoints(),1,7) == substr(font.col, 1,7) ~ substr(font.col,1,7) | ||
| ) | ||
| ) %>% | ||
| dplyr::ungroup() %>% | ||
| dplyr::mutate( | ||
| html_text = paste0( | ||
| "<p style = 'color: ", | ||
| font.col2, | ||
| "; background-color:", | ||
| background_color, | ||
| "; border-color: #000; border-style: solid; border-width: 0.1px", | ||
| ";'> ", | ||
| x(), | ||
| ":", |
| background_color = dplyr::case_when( | ||
| substr(ColorPoints(),1,7) != substr(font.col, 1,7) ~ substr(font.col, 1,7), | ||
| substr(ColorPoints(),1,7) == substr(font.col, 1,7) ~ "" | ||
| ), |
| !!rlang::sym(x()), | ||
| ", ", | ||
| "</br>", | ||
| tmp$text, |
Comment on lines
+428
to
+448
| background_color = dplyr::case_when( | ||
| substr(ColorPoints(),1,7) != substr(font.col, 1,7) ~ substr(font.col, 1,7), | ||
| substr(ColorPoints(),1,7) == substr(font.col, 1,7) ~ "" | ||
| ), | ||
| ) %>% | ||
| dplyr::rowwise() %>% | ||
| dplyr::mutate( | ||
| font.col2 = dplyr::case_when( | ||
| substr(ColorPoints(),1,7) != substr(font.col, 1,7) ~ font_color(font.col), | ||
| substr(ColorPoints(),1,7) == substr(font.col, 1,7) ~ substr(font.col,1,7) | ||
| ) | ||
| ) %>% | ||
| dplyr::ungroup() %>% | ||
| dplyr::mutate( | ||
| html_text = paste0( | ||
| "<p style = 'color: ", | ||
| .data$font.col2, | ||
| "; background-color:", | ||
| .data$background_color, | ||
| "; border-color: #000; border-style: solid; border-width: 0.1px", | ||
| ";'> ", |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
TammoReinders
approved these changes
May 19, 2026
TammoReinders
left a comment
Contributor
There was a problem hiding this comment.
Functionality of new color and sorting on hover tested. Everything works as intended.
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.
Updated hover panels with improved color contrast and built-in sorting feature to move selected/highlighted/reference subgroups to the top