My application has an area with some number of controls. Each control's background color expresses a state of some sort. The controls are also numbered via some text in their foreground. For example:
The problem is that I have been unable to find one color for the foreground text that contrasts well with all possible background colors. Also, I would like this to be dynamic if possible. Also, there are more colors than shown below. Specifically, yellow, which makes white text hard to see (I initially thought of using white for all but a white background, but this doesn't work out so well either)
So, my thought is to dynamically find a color of high contrast relative to the background at runtime. However, this means that the text will be colored differently across the controls, and I'm concerned that this may appear a bit odd or jarring to the user.
Has anyone else here had to tackle a similar problem? Does there exist a set of guidelines pertaining to the issue?