fix(web): keep theme placeholder text dimmer than entered text (#9104)
This commit is contained in:
1 parent
3b3465f2a9
commit
d0b4acbd13
3 files changed
+26
-1
No files matched your search
@@ -157,6 +157,9 @@ describe("theme files", () => {
|
||||
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeLessThan(5.5);
|
||||
expect(contrastRatio(colors.mutedForeground, colors.muted)).toBeGreaterThanOrEqual(4.5);
|
||||
expect(contrastRatio(colors.placeholder, colors.surfaceRaised)).toBeGreaterThanOrEqual(4.5);
|
||||
expect(contrastRatio(colors.placeholder, colors.surfaceRaised)).toBeLessThan(
|
||||
contrastRatio(colors.text, colors.surfaceRaised),
|
||||
);
|
||||
expect(colors.secondaryLabel).toBe(colors.textMuted);
|
||||
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
|
||||
expect(
|
||||
|
||||
@@ -917,7 +917,7 @@ export function createVividThemeColors(
|
||||
solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker"),
|
||||
);
|
||||
const mutedForeground = foregroundOn(mutedRgb);
|
||||
const placeholder = foregroundOn(surfaceRaisedRgb);
|
||||
const placeholder = themeRgbToThemeColor(readableThemeText(surfaceRaisedRgb, textRgb, 1, 4.6));
|
||||
|
||||
const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };
|
||||
|
||||
|
||||
@@ -90,6 +90,28 @@ describe("VS Code theme import", () => {
|
||||
expect(theme.colors.sidebarRowSelected).not.toBe(theme.colors.sidebar);
|
||||
});
|
||||
|
||||
it("keeps a fallback placeholder dimmer than entered text", () => {
|
||||
const theme = parseVsCodeThemeFile({
|
||||
name: "Dark placeholder fallback",
|
||||
type: "dark",
|
||||
colors: {
|
||||
"editor.background": "#1e1e2e",
|
||||
"editor.foreground": "#cdd6f4",
|
||||
"input.placeholderForeground": "#cdd6f473",
|
||||
},
|
||||
});
|
||||
|
||||
expect(
|
||||
contrastRatio(theme.colors.placeholder, theme.colors.surfaceRaised),
|
||||
).toBeGreaterThanOrEqual(4.5);
|
||||
expect(contrastRatio(theme.colors.placeholder, theme.colors.canvas)).toBeGreaterThanOrEqual(
|
||||
4.5,
|
||||
);
|
||||
expect(contrastRatio(theme.colors.placeholder, theme.colors.canvas)).toBeLessThan(
|
||||
contrastRatio(theme.colors.text, theme.colors.canvas),
|
||||
);
|
||||
});
|
||||
|
||||
it("fills every role the file omits with a readable derived value", () => {
|
||||
const theme = parseVsCodeThemeFile(VSCODE_DARK);
|
||||
const colors = getThemeColorsForMode(theme, "dark")!;
|
||||
|
||||
Reference in new issue
Block a user