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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading
, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content
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
4 changes: 2 additions & 2 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,7 +37,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand All@@ -54,7 +54,7 @@
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#e33f86",
accent: "#db2777",
chrome: "#fdf7fd",
},
dark: {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/chat/ModelPickerSidebar.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,7 @@ const SELECTED_INDICATOR_CLASS =
"pointer-events-none absolute -right-1 top-1/2 z-10 h-5 w-0.75 -translate-y-1/2 rounded-l-full bg-primary";
const BADGE_BASE_CLASS =
"pointer-events-none absolute -right-0.5 top-0.5 z-10 flex size-3.5 items-center justify-center rounded-full bg-transparent shadow-sm ";
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update `;
const NEW_BADGE_CLASS = `${BADGE_BASE_CLASS} text-update-foreground `;

/** Opens toward the rail so the list stays readable (not over the model names). */
const PICKER_TOOLTIP_SIDE = "left" as const;
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/ProviderInstanceCard.tsx
Original file line numberDiff line numberDiff line change
Expand Up@@ -619,7 +619,7 @@ export function ProviderInstanceCard({
"size-5 rounded-sm p-0",
versionAdvisory.emphasis === "strong"
? "text-warning hover:text-warning"
: "text-update hover:text-update",
: "text-update-foreground hover:text-update-foreground",
)}
aria-label="Update available — view details"
>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/components/settings/themeInspector.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -31,6 +31,9 @@ describe("changedThemePaintKinds", () => {
describe("themeRoleFromUtilityClass", () => {
it("maps semantic utilities to their actual palette role", () => {
expect(themeRoleFromUtilityClass("text-foreground", "foreground")).toBe("text");
expect(themeRoleFromUtilityClass("text-muted-foreground", "foreground")).toBe(
"mutedForeground",
);
expect(themeRoleFromUtilityClass("bg-primary/90", "background")).toBe("messageAction");
expect(themeRoleFromUtilityClass("ring-ring", "border")).toBe("focus");
});
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/settings/themeInspector.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,7 +38,7 @@ const THEME_UTILITY_ROLES: Readonly<Partial<Record<string, ThemeColorRole>>> = {
secondary: "secondary",
"secondary-foreground": "secondaryForeground",
muted: "muted",
"muted-foreground": "textMuted",
"muted-foreground": "mutedForeground",
placeholder: "placeholder",
"secondary-label": "secondaryLabel",
"icon-muted": "iconMuted",
Expand Down
10 changes: 5 additions & 5 deletions apps/web/src/index.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -899,7 +899,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: var(--color-zinc-200);
--input: var(--color-zinc-300);
--ring: oklch(0.488 0.217 264);
--ring: var(--primary);
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-700);
Expand DownExpand Up@@ -943,7 +943,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--card-foreground: var(--color-neutral-100);
--popover: color-mix(in srgb, var(--background) 94%, var(--color-white));
--popover-foreground: var(--color-neutral-100);
--primary: oklch(0.588 0.217 264);
--primary: oklch(0.571 0.21 264);
--primary-foreground: var(--color-white);
--secondary: --alpha(var(--color-white) / 4%);
--secondary-foreground: var(--color-neutral-100);
Expand All@@ -965,7 +965,7 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
--destructive: var(--error);
--border: --alpha(var(--color-white) / 6%);
--input: --alpha(var(--color-white) / 8%);
--ring: oklch(0.588 0.217 264);
--ring: var(--primary);
Comment thread
cursor[bot] marked this conversation as resolved.
--destructive-foreground: var(--error-foreground);
--info: var(--color-blue-500);
--info-foreground: var(--color-blue-400);
Expand DownExpand Up@@ -1076,7 +1076,7 @@ html.dark[data-theme-id] {
--secondary: var(--app-theme-secondary);
--secondary-foreground: var(--app-theme-secondary-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
Comment thread
cursor[bot] marked this conversation as resolved.
--placeholder: var(--app-theme-placeholder);
--secondary-label: var(--app-theme-secondary-label);
--icon-muted: var(--app-theme-icon-muted);
Expand DownExpand Up@@ -1326,7 +1326,7 @@ html[data-theme-id] [data-app-sidebar] {
--accent: var(--app-theme-accent-surface);
--accent-foreground: var(--app-theme-accent-surface-foreground);
--muted: var(--app-theme-muted);
--muted-foreground: var(--app-theme-text-muted);
--muted-foreground: var(--app-theme-muted-foreground);
--border: var(--app-theme-border);
--input: var(--app-theme-input);
--sidebar: var(--app-theme-sidebar);
Expand Down
21 changes: 13 additions & 8 deletions apps/web/src/themePalette.test.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -113,6 +113,8 @@ describe("theme files", () => {
expect(contrastRatio(colors.text, colors.canvas)).toBeGreaterThanOrEqual(7);
expect(contrastRatio(colors.textMuted, colors.canvas)).toBeGreaterThanOrEqual(4.5);
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(colors.secondaryLabel).toBe(colors.textMuted);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
expect(
Expand DownExpand Up@@ -169,7 +171,7 @@ describe("theme files", () => {
colors: {
canvas: "#07152f",
accent: "#67c2ff",
placeholder: "#8f8699",
placeholder: "#968d9f",
},
});
});
Expand DownExpand Up@@ -315,9 +317,7 @@ describe("theme files", () => {
4.5,
);
expect(contrastRatio(colors.sidebarForeground, colors.sidebar)).toBeGreaterThanOrEqual(4.5);
// The live light primary is intended for filled controls and clears the
// non-text UI-component threshold rather than normal-text AA.
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(3);
expect(contrastRatio(colors.accentForeground, colors.accent)).toBeGreaterThanOrEqual(4.5);
}
});

Expand All@@ -340,9 +340,7 @@ describe("theme files", () => {
1,
);
}
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(
theme === T3_CHAT_THEME ? 3 : 4.5,
);
expect(contrastRatio(colors!.accentForeground, colors!.accent)).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.toolbarControlForeground, colors!.toolbarControl),
).toBeGreaterThanOrEqual(4.5);
Expand All@@ -351,7 +349,14 @@ describe("theme files", () => {
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageAction),
).toBeGreaterThanOrEqual(theme === T3_CHAT_THEME ? 3 : 4.5);
).toBeGreaterThanOrEqual(4.5);
expect(
contrastRatio(colors!.messageActionForeground, colors!.messageActionHover),
).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.mutedForeground, colors!.muted)).toBeGreaterThanOrEqual(4.5);
expect(contrastRatio(colors!.placeholder, colors!.surfaceRaised)).toBeGreaterThanOrEqual(
4.5,
);
}
}
});
Expand Down
43 changes: 25 additions & 18 deletions apps/web/src/themePalette.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -325,6 +325,7 @@ function legacyThemeMode(theme: ThemePreference): ThemeAppearance | null {
// Measured from the live t3.chat default theme. Translucent chat surfaces are
// flattened over --chat-background so this opaque palette reproduces the
// pixels users see after T3 Chat's blur and noise layers are composited.
// Foreground pairs deviate where necessary to keep normal text at WCAG AA.
const T3_CHAT_LIGHT_COLORS: ThemeColors = {
canvas: "#fdf7fd",
// T3 Code's workspace header belongs to the chat panel, so keep it seamless
Expand All@@ -346,31 +347,31 @@ const T3_CHAT_LIGHT_COLORS: ThemeColors = {
border: "#eee1ed",
input: "#e7c1dc",
focus: "#db2777",
accent: "#e33f86",
accent: "#db2777",
accentForeground: "#ffffff",
secondary: "#f1c4e6",
secondaryForeground: "#77347c",
muted: "#eaa7cb",
mutedForeground: "#ac1668",
placeholder: "#ad83b0",
mutedForeground: "#8d1255",
placeholder: "#8b5f90",
secondaryLabel: "#ac1668",
iconMuted: "#ac1668",
error: "#f7086c",
errorForeground: "#9d174d",
errorSurface: "#fde4f1",
warning: "#f59e0b",
warningForeground: "#b45309",
warningForeground: "#b05109",
warningSurface: "#fcf0ea",
update: "#e33f86",
update: "#db2777",
updateForeground: "#ac1668",
updateSurface: "#fadfef",
accentSurface: "#f3e6f5",
accentSurfaceForeground: "#454554",
messageSurface: "#f7def2",
messageForeground: "#492c61",
messageAction: "#e33f86",
messageAction: "#db2777",
messageActionForeground: "#ffffff",
messageActionHover: "#d56698",
messageActionHover: "#c12269",
// T3 Chat uses a light lavender code surface in light mode. Keeping the
// dark plum pair here also leaked the dark palette into T3 Code's diffs.
codeBackground: "#f5ecf9",
Expand DownExpand Up@@ -422,7 +423,7 @@ const T3_CHAT_DARK_COLORS: ThemeColors = {
secondaryForeground: "#d4c7e1",
muted: "#423a45",
mutedForeground: "#e7d0dd",
placeholder: "#8f8699",
placeholder: "#968d9f",
secondaryLabel: "#e7d0dd",
iconMuted: "#d4c7e1",
error: "#9d174d",
Expand DownExpand Up@@ -549,8 +550,8 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
textMuted: "#818181",
border: "#191919",
input: "#1e1e1e",
focus: "#366ffb",
accent: "#366ffb",
focus: "#346bf1",
accent: "#346bf1",
accentForeground: "#ffffff",
secondary: "#141414",
secondaryForeground: "#f5f5f5",
Expand All@@ -565,16 +566,16 @@ const T3_CODE_DARK_THEME_COLORS: ThemeColors = {
warning: "#fe9a00",
warningForeground: "#ffb900",
warningSurface: "#312108",
update: "#366ffb",
update: "#346bf1",
updateForeground: "#51a2ff",
updateSurface: "#121c35",
updateSurface: "#121b34",
accentSurface: "#141414",
accentSurfaceForeground: "#f5f5f5",
messageSurface: "#141414",
messageForeground: "#f5f5f5",
messageAction: "#366ffb",
messageAction: "#346bf1",
messageActionForeground: "#ffffff",
messageActionHover: "#3265e3",
messageActionHover: "#3061d9",
codeBackground: "#111111",
codeForeground: "#f5f5f5",
sidebar: "#000000",
Expand DownExpand Up@@ -941,12 +942,14 @@ export function createVividThemeColors(
const sidebarRgb = themeOklchToRgb(sidebar);
const surface = surfaceAt(0.015);
const surfaceRaised = surfaceAt(0.05);
const surfaceRaisedRgb = themeOklchToRgb(surfaceRaised);
const surfaceOverlay = surfaceAt(0.075);
const border = surfaceAt(dark ? 0.16 : 0.12, Math.min(0.07, accent.C * 0.35));
const input = surfaceAt(dark ? 0.21 : 0.16, Math.min(0.08, accent.C * 0.4));
const secondary = surfaceAt(dark ? 0.1 : 0.06, Math.min(0.09, accent.C * 0.5));
const secondaryRgb = themeOklchToRgb(secondary);
const muted = surfaceAt(dark ? 0.06 : 0.04, Math.min(0.06, accent.C * 0.35));
const mutedRgb = themeOklchToRgb(muted);
const accentSurface = surfaceAt(dark ? 0.13 : 0.08, Math.min(0.11, accent.C * 0.55));
const accentSurfaceRgb = themeOklchToRgb(accentSurface);
const messageSurface = surfaceAt(dark ? 0.16 : 0.1, Math.min(0.13, accent.C * 0.6));
Expand All@@ -958,6 +961,8 @@ export function createVividThemeColors(
themeRgbToHexColor(
themeOklchToRgb(solveOklchLightness(textBase, surfaceRgb, 4.6, dark ? "lighter" : "darker")),
);
const mutedForeground = foregroundOn(mutedRgb);
const placeholder = foregroundOn(surfaceRaisedRgb);

const actionHover: ThemeOklch = { ...action, L: action.L + (dark ? 0.06 : -0.06) };

Expand DownExpand Up@@ -986,8 +991,8 @@ export function createVividThemeColors(
secondary: hex(secondary),
secondaryForeground: foregroundOn(secondaryRgb),
muted: hex(muted),
mutedForeground: themeRgbToHexColor(textMutedRgb),
placeholder: themeRgbToHexColor(textMutedRgb),
mutedForeground,
placeholder,
secondaryLabel: themeRgbToHexColor(textMutedRgb),
iconMuted: themeRgbToHexColor(textMutedRgb),
update: themeRgbToHexColor(accentRgb),
Expand DownExpand Up@@ -1174,6 +1179,8 @@ export function createManagedThemeColors(
const surfaceOverlay = mixThemeRgbColors(canvas, text, appearance === "dark" ? 0.18 : 0.06);
const secondary = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.2 : 0.08);
const muted = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.13 : 0.06);
const mutedForeground = readableThemeText(muted, text, 1, 4.6);
const placeholder = readableThemeText(surfaceRaised, text, 1, 4.6);
const accentSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.3 : 0.14);
const messageSurface = mixThemeRgbColors(canvas, accent, appearance === "dark" ? 0.36 : 0.18);
const toolbarControl = mixThemeRgbColors(chrome, accent, appearance === "dark" ? 0.2 : 0.08);
Expand DownExpand Up@@ -1244,8 +1251,8 @@ export function createManagedThemeColors(
secondary: themeRgbToHexColor(secondary),
secondaryForeground: themeRgbToHexColor(readableThemeForeground(secondary)),
muted: themeRgbToHexColor(muted),
mutedForeground: themeRgbToHexColor(textMuted),
placeholder: themeRgbToHexColor(textMuted),
mutedForeground: themeRgbToHexColor(mutedForeground),
placeholder: themeRgbToHexColor(placeholder),
secondaryLabel: themeRgbToHexColor(textMuted),
iconMuted: themeRgbToHexColor(textMuted),
accentSurface: themeRgbToHexColor(accentSurface),
Expand Down
Loading