We currently use some JavaScript to calculate the contrast color for the additional property text.
Browsers are starting to implement the new contrast-color() CSS function, which does exactly this.
We should probably use this instead of our custom JavaScript if it's available (both are based on the same algorithm).