I assume the ggplot scales creates some sort of function which reads the appropriate aes value and returns the colour, size, etc. Can this be used as a standalone function?
For example, to this function I will pass the necessary arguments (range, limits, high, low, etc.) and a value which I want to get the mapping for, and the output of the function will be the colour / size / etc.
# example of usage
HypotheticalScaleFunction(
range = c(0,10),
high = '#000000',
low = '#222222',
ValueToLookup = 5
)
# this should return -
"#111111"