Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: WDS text inputs visual refinements #35581

Merged
merged 3 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export class DarkModeTheme implements ColorModeTheme {
}

private get bgNeutralSubtle() {
const color = this.seedColor.clone();
const color = this.bgAccentSubtle.clone();

// Adjusted version of bgAccentSubtle (less or no chroma)
if (this.seedLightness > 0.29) {
Expand Down Expand Up @@ -726,15 +726,15 @@ export class DarkModeTheme implements ColorModeTheme {
// Neutral foreground. Slightly less prominent than main fg
const color = this.fg.clone();

color.oklch.l -= 0.02;
color.oklch.l -= 0.1;

return color;
}

private get fgNeutralSubtle() {
const color = this.fgNeutral.clone();

color.oklch.l -= 0.15;
color.oklch.l -= 0.3;

return color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,23 +391,19 @@ export class LightModeTheme implements ColorModeTheme {
}

private get bgNeutralSubtle() {
const color = this.seedColor.clone();
const color = this.bgAccentSubtle.clone();

// Adjusted version of bgAccentSubtle (less or no chroma)
// Adjusted version of bgAccentSubtle (less or no chroma), slightly higher lightness since neutrals are perceived heavier than saturated colors
if (this.seedIsVeryLight) {
color.oklch.l = 0.985;
color.oklch.l = 0.955;
}

if (!this.seedIsVeryLight) {
color.oklch.l = 0.935;
color.oklch.l = 0.97;
}

if (this.seedChroma > 0.001) {
color.oklch.c = 0.001;
}

if (this.seedIsAchromatic) {
color.oklch.c = 0;
if (this.seedChroma > 0.002) {
color.oklch.c = 0.002;
}

return color;
Expand All @@ -416,7 +412,7 @@ export class LightModeTheme implements ColorModeTheme {
private get bgNeutralSubtleHover() {
const color = this.bgNeutralSubtle.clone();

color.oklch.l += 0.02;
color.oklch.l += 0.012;

return color;
}
Expand Down Expand Up @@ -734,15 +730,15 @@ export class LightModeTheme implements ColorModeTheme {
// Neutral foreground. Slightly less prominent than main fg
const color = this.fg.clone();

color.oklch.l += 0.1;
color.oklch.l += 0.125;

return color;
}

private get fgNeutralSubtle() {
const color = this.fgNeutral.clone();

color.oklch.l += 0.1;
color.oklch.l += 0.35;

return color;
}
Expand Down Expand Up @@ -1164,15 +1160,15 @@ export class LightModeTheme implements ColorModeTheme {
// Low contrast indicator of interactivity in TextInput and similar
const color = this.bgNeutralSubtle.clone();

color.oklch.l -= 0.06;
color.oklch.l -= 0.03;

return color;
}

private get bdOnNeutralSubtleHover() {
const color = this.bdOnNeutralSubtle.clone();

color.oklch.l += 0.03;
color.oklch.l -= 0.015;

return color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,19 +567,19 @@ describe("fgNeutral color", () => {
it("should return correct color when chroma < 0.04", () => {
const { fgNeutral } = new DarkModeTheme("oklch(0.45 0.03 60)").getColors();

expect(fgNeutral).toEqual("rgb(88.912% 88.912% 88.912%)");
expect(fgNeutral).toEqual("rgb(78.709% 78.709% 78.709%)");
});

it("should return correct color when chroma > 0.04 and hue is between 120 and 300", () => {
const { fgNeutral } = new DarkModeTheme("oklch(0.45 0.1 150)").getColors();

expect(fgNeutral).toEqual("rgb(86.896% 89.904% 87.34%)");
expect(fgNeutral).toEqual("rgb(76.736% 79.678% 77.172%)");
});

it("should return correct color when chroma > 0.04 and hue is not between 120 and 300", () => {
const { fgNeutral } = new DarkModeTheme("oklch(0.45 0.1 110)").getColors();

expect(fgNeutral).toEqual("rgb(89.043% 89.298% 85.788%)");
expect(fgNeutral).toEqual("rgb(78.837% 79.085% 75.653%)");
});
});

Expand All @@ -589,7 +589,7 @@ describe("fgNeutralSubtle color", () => {
"oklch(0.45 0.03 60)",
).getColors();

expect(fgNeutralSubtle).toEqual("rgb(69.98% 69.98% 69.98%)");
expect(fgNeutralSubtle).toEqual("rgb(42.772% 42.772% 42.772%)");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,28 +307,28 @@ describe("bgNeutralSubtle color", () => {
const { bgNeutralSubtle } = new LightModeTheme(
"oklch(0.95 0.03 170)",
).getColors();
expect(bgNeutralSubtle).toEqual("rgb(98.026% 98.026% 98.026%)");
expect(bgNeutralSubtle).toEqual("rgb(93.635% 94.291% 94.022%)");
});

it("should return correct color when lightness < or equal to 0.93", () => {
const { bgNeutralSubtle } = new LightModeTheme(
"oklch(0.92 0.03 170)",
).getColors();
expect(bgNeutralSubtle).toEqual("rgb(91.499% 91.499% 91.499%)");
expect(bgNeutralSubtle).toEqual("rgb(95.592% 96.251% 95.981%)");
});

it("should return correct color when seedChroma > 0.01", () => {
const { bgNeutralSubtle } = new LightModeTheme(
"oklch(0.92 0.1 170)",
).getColors();
expect(bgNeutralSubtle).toEqual("rgb(91.268% 91.594% 91.461%)");
expect(bgNeutralSubtle).toEqual("rgb(95.592% 96.251% 95.981%)");
});

it("should return correct color when chroma < 0.04", () => {
const { bgNeutralSubtle } = new LightModeTheme(
"oklch(0.92 0.03 170)",
).getColors();
expect(bgNeutralSubtle).toEqual("rgb(91.499% 91.499% 91.499%)");
expect(bgNeutralSubtle).toEqual("rgb(95.592% 96.251% 95.981%)");
});
});

Expand All @@ -338,7 +338,7 @@ describe("bgNeutralSubtleHover color", () => {
"oklch(0.92 0.1 170)",
).getColors();

expect(bgNeutralSubtleHover).toEqual("rgb(93.867% 94.195% 94.061%)");
expect(bgNeutralSubtleHover).toEqual("rgb(97.164% 97.825% 97.554%)");
});
});

Expand All @@ -348,7 +348,7 @@ describe("bgNeutralSubtleActive color", () => {
"oklch(0.92 0.1 170)",
).getColors();

expect(bgNeutralSubtleActive).toEqual("rgb(89.974% 90.299% 90.166%)");
expect(bgNeutralSubtleActive).toEqual("rgb(94.286% 94.944% 94.674%)");
});
});

Expand Down Expand Up @@ -597,19 +597,19 @@ describe("fgNeutral color", () => {
it("should return correct color when chroma < 0.04", () => {
const { fgNeutral } = new LightModeTheme("oklch(0.45 0.03 60)").getColors();

expect(fgNeutral).toEqual("rgb(10.396% 10.396% 10.396%)");
expect(fgNeutral).toEqual("rgb(12.685% 12.685% 12.685%)");
});

it("should return correct color when chroma > 0.04 and hue is between 120 and 300", () => {
const { fgNeutral } = new LightModeTheme("oklch(0.45 0.1 150)").getColors();

expect(fgNeutral).toEqual("rgb(9.6799% 10.739% 9.8424%)");
expect(fgNeutral).toEqual("rgb(11.952% 13.038% 12.117%)");
});

it("should return correct color when chroma > 0.04 and hue is not between 120 and 300", () => {
const { fgNeutral } = new LightModeTheme("oklch(0.45 0.1 110)").getColors();

expect(fgNeutral).toEqual("rgb(10.444% 10.527% 9.2918%)");
expect(fgNeutral).toEqual("rgb(12.734% 12.82% 11.553%)");
});
});

Expand All @@ -619,7 +619,7 @@ describe("fgNeutralSubtle color", () => {
"oklch(0.45 0.03 60)",
).getColors();

expect(fgNeutralSubtle).toEqual("rgb(19.892% 19.892% 19.892%)");
expect(fgNeutralSubtle).toEqual("rgb(49.631% 49.631% 49.631%)");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"2": "2px"
},
"opacity": {
"disabled": 0.3
"disabled": 0.65
},
"zIndex": {
"1": 3,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
*-----------------------------------------------------------------------------
*/
& [data-field-input] :is(input, textarea)::placeholder {
color: var(--color-fg-neutral-subtle);
color: var(--color-fg-neutral-subtle) !important;
opacity: 1;
}

Expand Down
Loading