chore: Add chatwoot utils package (#2307)

* add chatwoot utils package

* remove color helper

* replace contrasting text color  with chatwoot util
This commit is contained in:
Muhsin Keloth
2021-05-24 12:43:03 +05:30
committed by GitHub
parent 58dd6d37e0
commit 62d19911be
6 changed files with 9 additions and 11 deletions

View File

@@ -1,8 +0,0 @@
export const getContrastingTextColor = bgColor => {
const color = bgColor.replace('#', '');
const r = parseInt(color.slice(0, 2), 16);
const g = parseInt(color.slice(2, 4), 16);
const b = parseInt(color.slice(4, 6), 16);
// http://stackoverflow.com/a/3943023/112731
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? '#000000' : '#FFFFFF';
};