r-lib / scales

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

Re: palette registry/lookup #477

Open teunbrand opened 1 week ago

teunbrand commented 1 week ago

These are just some notes from the meeting we had off-github, so I can safely forget them in a while.

Inspiration: https://github.com/EmilHvitfeldt/paletteer?tab=readme-ov-file#examples

teunbrand commented 1 week ago

Should we do away with the current registration mechanism and ensure that we lookup "foobar::pal_xyz" regardless of whether that function was registered as a palette?

If we recommend packages export a colour vector, we can simply use as_continuous_pal(pkgname::col_vec) instead of as_continuous_pal('pkgname::col_vec'). In this case, there is no need to register a palette.

The set_palette() function is still convenient if you have a palette function instead of a colour vector. This is convenient if palettes construct their colours mathematically instead of interpolate between known colours (like pal_hue() does for example).