Skip to contents

Looks up key in a module's defaults and returns it as a named vector of hex colors suitable for resolve_palette() and multiColorPicker(). Values may be given as R color names ("red") or hex codes; both are normalized to #RRGGBB. Anything that is not a fully named character vector is ignored, consistent with get_default()'s silent-fallback contract.

Usage

default_group_colors(defaults, key)

Arguments

defaults

A named list of default values, or NULL.

key

Character string — the color input's id, e.g. "palette.colours".

Value

A named character vector of hex colors, or NULL when defaults supplies no usable mapping.

Author

Jared Andrews

Examples

default_group_colors(list(palette.colours = c(A = "red", B = "#00FF00")), "palette.colours")
#>         A         B 
#> "#FF0000" "#00FF00" 
default_group_colors(list(palette.colours = c("red", "blue")), "palette.colours")
#> NULL