Using the code in this thread:
Trying to get the contrasting text colour for a (partially) transparent label where the parent is a non-transparent panel.
In the great majority the above code gets the right contrasting colour but with lower values for the A of ARGB the contrasting colour can
be wrong, mainly (only?) giving white when it should be black.
For example:
Panel colour: ARGB 255, 255, 255, 100
Label colour: ARGB 10, 150, 150, 150
This will give the contrasting colour white, but clearly this should be black.
How should this be coded to get the right contrasting colour?
RBS
Achieving a Contrast between Label Color and Label TextColor
I use this code and it works in most cases for an xCLV items: lbldoctor.Color=Rnd(xui.Color_Black, xui.Color_White) lbldoctor.textColor=Rnd(xui.Color_Black, xui.Color_White) What is the best way to insure that there is always a contrast between the label color and its text color, so the text is...
www.b4x.com
Trying to get the contrasting text colour for a (partially) transparent label where the parent is a non-transparent panel.
In the great majority the above code gets the right contrasting colour but with lower values for the A of ARGB the contrasting colour can
be wrong, mainly (only?) giving white when it should be black.
For example:
Panel colour: ARGB 255, 255, 255, 100
Label colour: ARGB 10, 150, 150, 150
This will give the contrasting colour white, but clearly this should be black.
How should this be coded to get the right contrasting colour?
RBS