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: Adjust prominence of icon and main text in StatBox #34729

Closed
wants to merge 1 commit into from
Closed
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 @@ -716,25 +716,10 @@ export class DarkModeTheme implements ColorModeTheme {
}

private get fgNeutral() {
// Desatured version of the seed for harmonious combination with backgrounds and accents.
const color = this.fgAccent.clone();

// Minimal contrast that we set for fgAccent (60) is too low for a gray color
if (this.bg.contrastAPCA(this.fgAccent) < 75) {
color.oklch.l += 0.04;
}

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

if (this.seedIsCold && !this.seedIsAchromatic) {
color.oklch.c = 0.03;
}
// Neutral foreground. Slightly less prominent than main fg
const color = this.fg.clone();

if (!this.seedIsCold && !this.seedIsAchromatic) {
color.oklch.c = 0.01;
}
color.oklch.l -= 0.02;

return color;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,25 +731,10 @@ export class LightModeTheme implements ColorModeTheme {
}

private get fgNeutral() {
// Desatured version of the seed for harmonious combination with backgrounds and accents.
const color = this.fgAccent.clone();

// Minimal contrast that we set for fgAccent (60) is too low for a gray color
if (this.bg.contrastAPCA(this.fgAccent) < 75) {
color.oklch.l -= 0.2;
}

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

if (this.seedIsCold && !this.seedIsAchromatic) {
color.oklch.c = 0.003;
}
// Neutral foreground. Slightly less prominent than main fg
const color = this.fg.clone();

if (!this.seedIsCold && !this.seedIsAchromatic) {
color.oklch.c = 0.001;
}
color.oklch.l += 0.1;

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(81.873% 81.873% 81.873%)");
expect(fgNeutral).toEqual("rgb(88.912% 88.912% 88.912%)");
});

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(76.801% 84.271% 77.971%)");
expect(fgNeutral).toEqual("rgb(86.896% 89.904% 87.34%)");
});

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(81.979% 82.19% 79.311%)");
expect(fgNeutral).toEqual("rgb(89.043% 89.298% 85.788%)");
});
});

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

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

Expand Down
Original file line number Diff line number Diff line change
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(33.384% 33.384% 33.384%)");
expect(fgNeutral).toEqual("rgb(10.396% 10.396% 10.396%)");
});

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(32.964% 33.592% 33.055%)");
expect(fgNeutral).toEqual("rgb(9.6799% 10.739% 9.8424%)");
});

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(33.392% 33.411% 33.167%)");
expect(fgNeutral).toEqual("rgb(10.444% 10.527% 9.2918%)");
});
});

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

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

Expand Down
Loading