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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
8
app/javascript/shared/helpers/colorHelper.js
Normal file
8
app/javascript/shared/helpers/colorHelper.js
Normal 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;
|
||||
};
|
||||
10
app/javascript/shared/helpers/specs/colorHelper.spec.js
Normal file
10
app/javascript/shared/helpers/specs/colorHelper.spec.js
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user