Skip to content

Commit 8efc358

Browse files
committed
fix bug oops + reduce big icon contrast required
1 parent 8169593 commit 8efc358

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/components/src/utils/polyfill-theme.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const darken = (color, value) =>
228228
.hex();
229229

230230
const withContrast = (color, background, type, contrastType = 'text') => {
231-
const contrastRatio = { text: 4.5, icon: 3 };
231+
const contrastRatio = { text: 4.5, icon: 1.6 };
232232
const contrast = contrastRatio[contrastType];
233233

234234
if (Color(color).contrast(Color(background)) > contrast) return color;
@@ -238,5 +238,10 @@ const withContrast = (color, background, type, contrastType = 'text') => {
238238

239239
// recursively increase contrast
240240
const increaseContrast = type === 'dark' ? lighten : darken;
241-
return withContrast(increaseContrast(color, 0.1), background, type);
241+
return withContrast(
242+
increaseContrast(color, 0.1),
243+
background,
244+
type,
245+
contrastType
246+
);
242247
};

0 commit comments

Comments
 (0)