Skip to content

Commit

Permalink
chore: remove old implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie committed Nov 25, 2024
1 parent baacf95 commit 9785587
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,6 @@ rename2 <- function(x, ...) {

# Get an accessible color contrast for a specified bg_color
# (and return NULL+warn on failure)
get_color_contrast_old <- function(bg_color) {
# Use a specific name that won't clash with other variables
nm <- "__bslib-custom-bg-color__"
theme <- bs_add_variables(bs_theme(), !!nm := bg_color)
tryCatch(
bs_get_contrast(theme, nm)[[1]],
error = function(e) {
warning("Failed to compute a contrasting color for '", bg_color, "'", call. = FALSE)
NULL
}
)
}

get_color_contrast <- function(bg_color) {
utils_layer <- sass::sass_layer(
functions = sass::sass_file(
Expand All @@ -168,6 +155,7 @@ get_color_contrast <- function(bg_color) {
options = sass::sass_options(source_map_embed = FALSE)
)
# example: css <- "._ {\n --RET: #fff;\n}"
# we'll split to get value: ^ ^
ret <- strsplit(css, "--RET:")[[1]][2]
trimws(strsplit(ret, ";")[[1]][1])
}, error = function(err) {
Expand Down

0 comments on commit 9785587

Please sign in to comment.