Skip to content

Commit

Permalink
Merge pull request #788 from pharmaR/jt-fix_get_text_color
Browse files Browse the repository at this point in the history
Fix `get_text_color()`
  • Loading branch information
aclark02-arcus authored Jun 5, 2024
2 parents fdb0850 + 3fa5bad commit a154676
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions R/mod_decision_automation_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,14 @@ get_text_color <- function(hex) {
lum <-
hex %>%
stringr::str_remove("#") %>%
substring(0:2*2+1,1:3*2) %>%
strtoi(16) %>%
`*`(c(299, 587, 114)) %>%
sum() %>%
purrr::map_dbl(
~ {
.x %>%
substring(0:2*2+1,1:3*2) %>%
strtoi(16) %>%
`*`(c(299, 587, 114)) %>%
sum()
}) %>%
`/`(1000)

ifelse(lum <= 130, "#ffffff", "#000000")
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6502,7 +6502,7 @@
"checksum": "91d23477f73284b74e4f452911214986"
},
"R/mod_decision_automation_utils.R": {
"checksum": "294bb444a83250e55fa6dec75c1491e6"
"checksum": "c8b8f4676b824effbafddcd136de7998"
},
"R/mod_decision_automation.R": {
"checksum": "e22e1f4c044bc9f11c46a5fcdba33063"
Expand Down

0 comments on commit a154676

Please sign in to comment.