fix: Update colors in widget buttons to fix invalid colors (#6033)

Co-authored-by: nithindavid <1277421+nithindavid@users.noreply.github.com>
Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2022-12-15 04:51:20 +05:30
committed by GitHub
parent 26e05de642
commit 2972319026
11 changed files with 99 additions and 21 deletions

View File

@@ -33,7 +33,7 @@ export default {
margin-left: -$space-one;
border-radius: 50%;
border: 2px solid rgba(255, 255, 255, 0.7);
border-top-color: lighten($color-woot, 10%);
border-top-color: rgba(255, 255, 255, 0.2);
animation: spinner 0.9s linear infinite;
}
}

View File

@@ -0,0 +1,8 @@
export const isWidgetColorLighter = color => {
const colorToCheck = color.replace('#', '');
const c_r = parseInt(colorToCheck.substr(0, 2), 16);
const c_g = parseInt(colorToCheck.substr(2, 2), 16);
const c_b = parseInt(colorToCheck.substr(4, 2), 16);
const brightness = (c_r * 299 + c_g * 587 + c_b * 114) / 1000;
return brightness > 225;
};

View File

@@ -0,0 +1,10 @@
import { isWidgetColorLighter } from 'shared/helpers/colorHelper';
describe('#isWidgetColorLighter', () => {
it('returns true if color is lighter', () => {
expect(isWidgetColorLighter('#ffffff')).toEqual(true);
});
it('returns false if color is darker', () => {
expect(isWidgetColorLighter('#000000')).toEqual(false);
});
});