Users can set the background-color of a button through a textbox that accept RGB hexadecimal notation: ff00ff
, ccaa22
, etc. So I need to set the text color to the opposite. Not sure about the terminology (opposite color) but the idea is assure readability.
相关问题
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
- Can php detect if javascript is on or not?
Salaman's code is good but sometimes his inversion is not readable enough. I use YCbCr and just change gray scale.
jsfiddle demo
Here is a very small way to complement the hex value //hex value like "aa00cc"