Used for both continuous and binned scales, this function creates a gradient of colors from the given high and low hex codes (or, by default, from the "200" to "800" values for a chosen color option).

sage_gradient_pal(option = "royal", low = NULL, high = NULL)

Arguments

option

One of the Sage colors. See names(sage_colors) for a list.

low

Optional starting value (if NULL, will default to the "200" value for the chosen color option)

high

Optional ending value (if NULL, will default to the "800" value for the chosen color option)

Value

A function that can be called on values between 0 and 1 to return the hex color of the gradient at that point in the range.

Examples

sage_gradient_pal()(1)
#> [1] "#251454"
sage_gradient_pal()(0.5)
#> [1] "#7C6B99"
sage_gradient_pal(
  option = "powder",
  low = sage_colors[["powder"]][["300"]],
  high = sage_colors[["powder"]][["700"]]
)(1)
#> [1] "#2F8E94"