r-lib / scales

Tools for ggplot2 scales
https://scales.r-lib.org
Other
407 stars 109 forks source link

Additional colour manipulation functions #424

Closed teunbrand closed 2 months ago

teunbrand commented 7 months ago

This PR aims to fix #423.

Briefly, it adds 5 new functions demonstrated below:

devtools::load_all("~/packages/scales/")
#> ℹ Loading scales

x <- rainbow(9)
show_col(col_shift(x, 90))

show_col(col_saturate(x, -50))

show_col(col_darker(x, 20))

show_col(col_lighter(x, 20))

show_col(col_mix(x, "limegreen"))

Created on 2024-04-14 with reprex v2.1.0

I'm not 100% sure that HSL space is the 'best' space for lighter/darker/saturate, but it works well enough I think.