Demand:
Because the background of some white text is close to white, it will cause the text to be invisible, so it is necessary to set the text color to black for this kind of background color.
Known Invalid method:
Turn the color into 10 to not be able to determine whether it is close to white
红色的值虽然是16711680 但和白色可以很好的区分.但是灰色 12632256 比红色要小,但是和白色是很难区分的.
Reply content:
Demand:
Because the background of some white text is close to white, it will cause the text to be invisible, so it is necessary to set the text color to black for this kind of background color.
Known Invalid method:
Turn the color into 10 to not be able to determine whether it is close to white
红色的值虽然是16711680 但和白色可以很好的区分.但是灰色 12632256 比红色要小,但是和白色是很难区分的.
The reverse. The smaller the brighter the more
Use the RGB value to judge can, find an unclear font to take a color, satisfy at the same time greater than the RGB value of the affirmation is not clear, you can also add a mean to judge
Each of the RGB to the decimal and 255 to compare, for example, each value and 255 of the gap is within 5, then it is determined that he and white very close, and can not directly convert the entire hexadecimal to decimal.