I use this code and it works in most cases for an xCLV items:
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 always readable and visible. I do not want the label color to drown the text. Take a look at the forum avatars for instance. If the avatar is M, you will never see the same 2 avatars having the same colors and there is always a nice contrast between the label text color and the label background color. I like to achieve something like that.
B4X:
lbldoctor.Color=Rnd(xui.Color_Black, xui.Color_White)
lbldoctor.textColor=Rnd(xui.Color_Black, xui.Color_White)