Skip to content

Commit 2121a76

Browse files
fix get_text_color()
1 parent fdb0850 commit 2121a76

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

R/mod_decision_automation_utils.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,14 @@ get_text_color <- function(hex) {
9191
lum <-
9292
hex %>%
9393
stringr::str_remove("#") %>%
94-
substring(0:2*2+1,1:3*2) %>%
95-
strtoi(16) %>%
96-
`*`(c(299, 587, 114)) %>%
97-
sum() %>%
94+
purrr::map_dbl(
95+
~ {
96+
.x %>%
97+
substring(0:2*2+1,1:3*2) %>%
98+
strtoi(16) %>%
99+
`*`(c(299, 587, 114)) %>%
100+
sum()
101+
}) %>%
98102
`/`(1000)
99103

100104
ifelse(lum <= 130, "#ffffff", "#000000")

0 commit comments

Comments
 (0)