I don't even know if I am using the right term calling it a contrast-problem so let me explain better.....
I have an activity with a fixed black background-colour. On the activity I have placed a label where the text-colour changes randomly every second. What happens is that sometimes (inevitably) the text-color generated is black, just like the activity-colour, or is a similar colour-shade which makes it impossible to read the text in the label.
So, I am wondering if there is some kind of formula which can be used to avoid this kind of contrast-issue between the two colours and which makes the text illegible or nearly. If yes and if there is a risk that the colours are very similar, what counter-measure can I choose to make sure that the text-color of the label will be readable. I guess I need to change one (or more) of the RGB-integers but again in what way?
Example-project is attached. Might not be easy to reproduce since this contrast-issue does not happens all the time but I guess it will eventually.
I have an activity with a fixed black background-colour. On the activity I have placed a label where the text-colour changes randomly every second. What happens is that sometimes (inevitably) the text-color generated is black, just like the activity-colour, or is a similar colour-shade which makes it impossible to read the text in the label.
So, I am wondering if there is some kind of formula which can be used to avoid this kind of contrast-issue between the two colours and which makes the text illegible or nearly. If yes and if there is a risk that the colours are very similar, what counter-measure can I choose to make sure that the text-color of the label will be readable. I guess I need to change one (or more) of the RGB-integers but again in what way?
Example-project is attached. Might not be easy to reproduce since this contrast-issue does not happens all the time but I guess it will eventually.