Skip to content

Commit d01d374

Browse files
committed
Spotted a few more visual problems, fixed
1 parent 0fb502b commit d01d374

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

app/client/packages/design-system/theming/src/color/src/LightModeTheme.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ export class LightModeTheme implements ColorModeTheme {
354354
// Simplified and adjusted version of bgAccentHover algorithm (bgNeutral has very low or no chroma)
355355

356356
if (this.bgNeutral.oklch.l < 0.06) {
357-
color.oklch.l += 0.3;
357+
color.oklch.l += 0.5;
358358
}
359359

360360
if (this.bgNeutral.oklch.l > 0.06 && this.bgNeutral.oklch.l < 0.14) {
@@ -749,7 +749,7 @@ export class LightModeTheme implements ColorModeTheme {
749749

750750
// For dark content on light background APCA contrast is positive. 60 is “The minimum level recommended for content text that is not body, column, or block text. In other words, text you want people to read.” Failure to reach this contrast level is most likely due to high lightness. Lightness and chroma are set to ones that reach the threshold universally regardless of hue.
751751
if (this.bg.contrastAPCA(this.seedColor) <= 60) {
752-
color.oklch.l = 0.45;
752+
color.oklch.l = 0.35;
753753

754754
if (this.seedIsAchromatic) {
755755
color.oklch.c = 0;
@@ -967,18 +967,19 @@ export class LightModeTheme implements ColorModeTheme {
967967

968968
private get bdAccent() {
969969
// Accent border color. Lighter and less saturated than accent to put focus on the text label and create nice-looking harmony.
970-
const color = this.seedColor.clone();
970+
const color = this.fgAccent.clone();
971971

972972
// For dark content on light background APCA contrast is positive. 15 is “The absolute minimum for any non-text that needs to be discernible and differentiable, but does not apply to semantic non-text such as icons”. In practice, thin borders are perceptually too subtle when using this as a threshould. 25 is used as the required minimum instead. Failure to reach this contrast level is most likely due to high lightness. Lightness and chroma are set to ones that reach the threshold universally regardless of hue.
973-
if (this.bg.contrastAPCA(this.seedColor) <= 25) {
974-
if (this.seedIsAchromatic) {
973+
if (this.bg.contrastAPCA(color) <= 25) {
974+
// If seed is achromatic make sure we don't produce parasitic coloring. Our standard achromatic cut-off is set too high for the very light seeds, so using chroma value checks instead.
975+
if (color.oklch.c <= 0.04) {
975976
color.oklch.l = 0.55;
976977
color.oklch.c = 0;
977978
}
978979

979-
if (!this.seedIsAchromatic) {
980+
if (color.oklch.c > 0.04) {
980981
color.oklch.l = 0.55;
981-
color.oklch.c = 0.15;
982+
color.oklch.c = 0.08;
982983
}
983984
}
984985

@@ -989,8 +990,7 @@ export class LightModeTheme implements ColorModeTheme {
989990
// Slightly subtler version of accent border, used in outlined buttons
990991
const color = this.bdAccent.clone();
991992

992-
color.oklch.l += 0.2;
993-
color.oklch.c -= 0.12;
993+
color.oklch.l += 0.35;
994994

995995
return color;
996996
}
@@ -1053,7 +1053,7 @@ export class LightModeTheme implements ColorModeTheme {
10531053
// Slightly subtler version of neutral border, used in outlined buttons
10541054
const color = this.bdNeutral.clone();
10551055

1056-
color.oklch.l += 0.2;
1056+
color.oklch.l += 0.35;
10571057

10581058
return color;
10591059
}

app/client/packages/design-system/theming/src/color/tests/LightModeTheme.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ describe("bgNeutralHover color", () => {
274274
"oklch(0.05 0.03 170)",
275275
).getColors();
276276

277-
expect(bgNeutralHover).toEqual("rgb(22.901% 22.901% 22.901%)");
277+
expect(bgNeutralHover).toEqual("rgb(44.47% 44.47% 44.47%)");
278278
});
279279

280280
it("should return correct color when lightness is between 0.06 and 0.14", () => {
@@ -298,23 +298,23 @@ describe("bgNeutralHover color", () => {
298298
"oklch(0.35 0.03 170)",
299299
).getColors();
300300

301-
expect(bgNeutralHover).toEqual("rgb(17.924% 17.924% 17.924%)");
301+
expect(bgNeutralHover).toEqual("rgb(38.857% 38.857% 38.857%)");
302302
});
303303

304304
it("should return correct color when lightness is between 0.7 and 0.955", () => {
305305
const { bgNeutralHover } = new LightModeTheme(
306306
"oklch(0.75 0.03 170)",
307307
).getColors();
308308

309-
expect(bgNeutralHover).toEqual("rgb(4.3484% 4.3484% 4.3484%)");
309+
expect(bgNeutralHover).toEqual("rgb(22.901% 22.901% 22.901%)");
310310
});
311311

312312
it("should return correct color when lightness > or equal to 0.955", () => {
313313
const { bgNeutralHover } = new LightModeTheme(
314314
"oklch(0.96 0.03 170)",
315315
).getColors();
316316

317-
expect(bgNeutralHover).toEqual("rgb(4.3484% 4.3484% 4.3484%)");
317+
expect(bgNeutralHover).toEqual("rgb(22.901% 22.901% 22.901%)");
318318
});
319319
});
320320

0 commit comments

Comments
 (0)