Finally, I've nicked a function that takes in a colour and returns white or black to ensure contrast. This is useful for when you need to add text that contrasts nicely with the background.

Instructions and installation here: https://github.com/nicucalcea/Ra11y

GitHub - nicucalcea/Ra11y: Collection of accessibility functions for R

Collection of accessibility functions for R. Contribute to nicucalcea/Ra11y development by creating an account on GitHub.

GitHub
@nicu
contrast() YES -- long needed