I am using this code to randomly change the color of my textView. I have a black background so sometimes these colors are hard to read.
int r = (rand.nextInt(176) * 80 ) / 256;
int g = (rand.nextInt(176) * 80 ) / 256;
int b = (rand.nextInt(176) * 80 ) / 256;
TextView pos = (TextView) view.findViewById(R.id.position);
pos.setText(((Integer)(position + 1)).toString());
pos.setTextSize(30);
pos.setTextColor(Color.argb(255,r,g,b));
TextView data = (TextView) view.findViewById(R.id.textOfTip);
data.setText(tipsList[position].toString());
data.setTextSize(24);
data.setTextColor(Color.argb(255,r,g,b));
My question is, how can i increase the brightness or luminous effect of the text color so they can read easily.
Best Regards
First, get your color in the format
0xAARRGGBB(example, solid red is 0xFFFF0000). Then, push it to the methodcolorToHSV. Next, change the L/V/B value (which vary slightly, but I think will be close enough for what you’re doing). Lastly, callHSVToColorto get your new color in0xAARRGGBBformat again. There are then several ways to convert this to R,G,B values, which usually involve byte shifting.Something like this:
Note: There is also
RGBToHSV, which may come in handy.