This convention is used at times to indicate a locally-scoped or private custom CSS property, which is how we'd like to use css() in bslib.
One option would be to update the regex so that underscores that are proceeded by -- are not replaced with dashes.
Another option would be to add a locally-defined helper function called var() that works inside css(). It could help with creating CSS variables or with using them, e.g.
red <- "#FF0000"
css(
var("_private-variable" = "private value"),
color = var("text-color", red)
)
#> [1] "--_private-variable:private value;color:var(--text-color, #FF0000)"
It's not possible to create CSS custom property names with
css()
that start with--_
or--__
because the underscores are converted into dashes.This convention is used at times to indicate a locally-scoped or private custom CSS property, which is how we'd like to use
css()
in bslib.One option would be to update the regex so that underscores that are proceeded by
--
are not replaced with dashes.Another option would be to add a locally-defined helper function called
var()
that works insidecss()
. It could help with creating CSS variables or with using them, e.g.