Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getContrastFontColor () {
- if(this.colorSelected.length == 7) {
- let r = parseInt(this.colorSelected.substr(1,2),16);
- let g = parseInt(this.colorSelected.substr(3,2),16);
- let b = parseInt(this.colorSelected.substr(5,2),16);
- r *= 0.299;
- g *= 0.587;
- b *= 0.114;
- if((r + g + b) > 186)
- return '#000000';
- else
- return '#ffffff';
- } else {
- return '#000000';
- }
- }
Add Comment
Please, Sign In to add comment