replace deprecated function
This commit is contained in:
@@ -13,9 +13,9 @@ export function getContrastYIQ(hexcolor: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse RGB values
|
// Parse RGB values
|
||||||
const r = parseInt(hexcolor.substr(0, 2), 16);
|
const r = parseInt(hexcolor.substring(0, 2), 16);
|
||||||
const g = parseInt(hexcolor.substr(2, 2), 16);
|
const g = parseInt(hexcolor.substring(2, 2), 16);
|
||||||
const b = parseInt(hexcolor.substr(4, 2), 16);
|
const b = parseInt(hexcolor.substring(4, 2), 16);
|
||||||
|
|
||||||
// Calculate YIQ brightness
|
// Calculate YIQ brightness
|
||||||
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
const yiq = (r * 299 + g * 587 + b * 114) / 1000;
|
||||||
|
|||||||
Reference in New Issue
Block a user