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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
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
25 changes: 24 additions & 1 deletion .agents/upstream-review.md
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
---
remote: t3code-upstream
branch: main
reviewed-through: "35172010b131510d36d0cef54e174926e38a3013"
reviewed-through: "2db08457f2f4eaaa713a067b2ea480ca2b583025"
reviewed-through-date: "2026-08-11"
---

Expand DownExpand Up@@ -591,6 +591,29 @@ Setup notes discovered during that pass, since they will bite the next session:
that the accessibility tree does not expose are unreachable by gesture; deep
links such as `pylon-code-dev://new/draft` are the reliable way in.

## 2026-08-11 (fifth batch) — `35172010b131510d36d0cef54e174926e38a3013..2db08457f2f4eaaa713a067b2ea480ca2b583025`

Two upstream commits, both adopted. **First batch to land through the pull
request workflow** rather than a fast-forward onto `pylon`, per the `Landing
changes` section added to `AGENTS.md` in PR #1. Each change set is its own PR,
so `L1` and `L2` may merge in either order.

DEF-1 and DEF-2 were re-evaluated against this head and both **stay deferred**.
Neither gate holds: the date is before 2026-08-25, and the fourteen-day churn
check on the pull-requests files still returns `cad2c9361` and `a7b0366cb`.

| Change set | Upstream | Decision | Pylon reference | Rationale or revisit condition |
| ---------- | --------------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| L1 | `2db08457f` / `#6207` | adopted | PR #2 | The Push quick action had no icon case and fell through to the generic `InfoIcon`; it now uses `CloudUploadIcon`, matching how push is already drawn elsewhere in the same file. Direct follow-up to K6 / `#6194`. |
| L2 | `083fa4ab2` / `#6036` | adopted | PR #3 | Palette generation moves to OKLCH, adding `culori` and `@types/culori`. Clean cherry-pick despite five diverged files. **K11 / `#6183` is an ancestor of this commit**, which is why it applies against the theme-aware artwork adopted in the fourth batch — taking them out of order would have fought. **`index.html` verified Pylon-first:** the diff adds no visible T3 branding and leaves `<title>Pylon (Alpha)</title>` untouched; the `t3-chat-dark` id and boot-script comments are pre-existing compatibility identifiers. |

Verification: `themePalette`, `themeBoot`, `vscodeThemeImport`, and
`SidebarStageBackdrop` pass (78 tests). Web typecheck, lint, and format clean.

**Not proven by tests:** whether the five built-in themes still _look_ right
after the color-space change. Palette math that computes cleanly can still shift
perceptibly, so L2 wants one pass in a real client after merge.

## Deferred register

Upstream work that has been reviewed and consciously _not_ adopted yet, with
Expand Down
127 changes: 72 additions & 55 deletions apps/web/index.html
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,89 +35,89 @@
// app colors before React mounts.
const DEFAULT_THEME_PALETTES = {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
};
// Keep this small boot-time copy in sync with the built-in palettes so
// the selected theme is visible before the app has mounted.
const BUILT_IN_THEME_PALETTES = {
"t3-chat": {
light: {
background: "#fdf7fd",
foreground: "#501854",
accent: "#db2777",
chrome: "#fdf7fd",
background: "oklch(0.982446 0.010114 325.653)",
foreground: "oklch(0.325698 0.116116 325.037)",
accent: "oklch(0.591646 0.217985 0.584)",
chrome: "oklch(0.982446 0.010114 325.653)",
},
dark: {
background: "#1f1a24",
foreground: "#f9f8fb",
accent: "#a3004c",
chrome: "#1f1a24",
background: "oklch(0.22813 0.020366 307.469)",
foreground: "oklch(0.980735 0.004092 301.426)",
accent: "oklch(0.460685 0.185347 4.099)",
chrome: "oklch(0.22813 0.020366 307.469)",
},
},
grove: {
light: {
background: "#f3f7f4",
foreground: "#241523",
accent: "#1b7d50",
chrome: "#f3f7f4",
background: "oklch(0.972369 0.005497 157.15)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.523295 0.112292 158.089)",
chrome: "oklch(0.972369 0.005497 157.15)",
},
dark: {
background: "#1b2821",
foreground: "#fffaff",
accent: "#69d69a",
chrome: "#1b2821",
background: "oklch(0.260865 0.02152 162.75)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.796228 0.133058 157.319)",
chrome: "oklch(0.260865 0.02152 162.75)",
},
},
ocean: {
light: {
background: "#f5f7f8",
foreground: "#241523",
accent: "#2672af",
chrome: "#f5f7f8",
background: "oklch(0.974199 0.002856 241.597)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.536684 0.120219 247.01)",
chrome: "oklch(0.974199 0.002856 241.597)",
},
dark: {
background: "#17212b",
foreground: "#fffaff",
accent: "#70b9ee",
chrome: "#17212b",
background: "oklch(0.242641 0.024125 250.573)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.758933 0.105833 241.548)",
chrome: "oklch(0.242641 0.024125 250.573)",
},
},
ember: {
light: {
background: "#f9f7f5",
foreground: "#241523",
accent: "#ae552a",
chrome: "#f9f7f5",
background: "oklch(0.976527 0.002685 60.725)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.552831 0.129438 44.656)",
chrome: "oklch(0.976527 0.002685 60.725)",
},
dark: {
background: "#291e1a",
foreground: "#fffaff",
accent: "#f09a64",
chrome: "#291e1a",
background: "oklch(0.245899 0.019144 42.044)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.762174 0.124117 52.082)",
chrome: "oklch(0.245899 0.019144 42.044)",
},
},
iris: {
light: {
background: "#f8f7f9",
foreground: "#241523",
accent: "#7253b9",
chrome: "#f8f7f9",
background: "oklch(0.976531 0.003855 303.226)",
foreground: "oklch(0.222003 0.03479 328.979)",
accent: "oklch(0.525348 0.15373 294.176)",
chrome: "oklch(0.976531 0.003855 303.226)",
},
dark: {
background: "#1d1929",
foreground: "#fffaff",
accent: "#9d7df2",
chrome: "#1d1929",
background: "oklch(0.225975 0.031062 293.741)",
foreground: "oklch(0.990339 0.008411 325.64)",
accent: "oklch(0.671712 0.169136 293.929)",
chrome: "oklch(0.225975 0.031062 293.741)",
},
},
};
Expand DownExpand Up@@ -152,9 +152,26 @@
}
};

const isHexColor = (value) =>
typeof value === "string" &&
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(value);
// The runtime decodes the same literal CSS formats into OKLCH. Keep
// contextual colors out: they cannot be resolved from stored data.
const SYSTEM_COLOR_KEYWORD =
/^(?:accentcolor(?:text)?|active(?:border|caption|text)|appworkspace|background|button(?:border|face|highlight|shadow|text)|canvas(?:text)?|captiontext|field(?:text)?|graytext|highlight(?:text)?|inactive(?:border|caption(?:text)?)|info(?:background|text)|linktext|mark(?:text)?|menu(?:text)?|scrollbar|selecteditem(?:text)?|threed(?:darkshadow|face|highlight|lightshadow|shadow)|visitedtext|window(?:frame|text)?)$/i;
const isThemeColor = (value) => {
if (typeof value !== "string" || typeof CSS === "undefined") return false;
const color = value.trim();
if (
/^(?:currentcolor|inherit|initial|revert|revert-layer|unset)$/i.test(color) ||
SYSTEM_COLOR_KEYWORD.test(color) ||
/\bfrom\b|(?:var|env|attr|calc|min|max|clamp)\(/i.test(color)
) {
return false;
}
const isLiteralColor =
/^#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(color) ||
/^[a-z]+$/i.test(color) ||
/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\(/i.test(color);
return isLiteralColor && CSS.supports("color", color);
};
const isRecord = (value) =>
typeof value === "object" && value !== null && !Array.isArray(value);
const isThemeId = (value) =>
Expand DownExpand Up@@ -322,13 +339,13 @@
const fallbackSplash = isDark ? SPLASH_COLORS.dark : SPLASH_COLORS.light;
const customSplash = customColors
? {
background: isHexColor(customColors.canvas)
background: isThemeColor(customColors.canvas)
? customColors.canvas
: (customDefaults?.background ?? fallbackSplash.background),
foreground: isHexColor(customColors.text)
foreground: isThemeColor(customColors.text)
? customColors.text
: (customDefaults?.foreground ?? fallbackSplash.foreground),
accent: isHexColor(customColors.accent)
accent: isThemeColor(customColors.accent)
? customColors.accent
: (customDefaults?.accent ?? fallbackSplash.accent),
}
Expand All@@ -350,7 +367,7 @@
}
document.documentElement.classList.toggle("dark", isDark);
const chromeColor = customColors
? isHexColor(customColors.chrome)
? isThemeColor(customColors.chrome)
? customColors.chrome
: (customDefaults?.chrome ?? fallbackSplash.background)
: builtInSplash
Expand Down
2 changes: 2 additions & 0 deletions apps/web/package.json
Original file line numberDiff line numberDiff line change
Expand Up@@ -33,6 +33,7 @@
"@tanstack/react-pacer": "^0.19.4",
"@tanstack/react-router": "^1.160.2",
"class-variance-authority": "^0.7.1",
"culori": "^4.0.2",
"effect": "catalog:",
"jose": "catalog:",
"lexical": "^0.41.0",
Expand All@@ -55,6 +56,7 @@
"@tanstack/router-plugin": "^1.161.0",
"@types/babel__core": "^7.20.5",
"@types/compression": "^1.8.1",
"@types/culori": "^4.0.1",
"@types/react": "~19.2.14",
"@types/react-dom": "~19.2.3",
"@vercel/config": "^0.3.0",
Expand Down
40 changes: 11 additions & 29 deletions apps/web/src/components/settings/ThemeColorPicker.tsx
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
import type { KeyboardEvent, PointerEvent } from "react";
import { memo, useCallback, useEffect, useRef, useState } from "react";
import { isThemeColor, type ThemeColorRole } from "../../themePalette";
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
import { cn } from "../../lib/utils";
import { Input } from "../ui/input";
import { Popover, PopoverPopup, PopoverTrigger } from "../ui/popover";
Expand DownExpand Up@@ -37,39 +37,18 @@ function clampThemeColor(value: number, min = 0, max = 1) {
}

/**
* The picker's plane and sliders operate on opaque six-digit hex, but theme
* colors may carry alpha. The suffix is preserved separately and re-attached
* on commit so adjusting hue or brightness cannot change transparency.
* The picker remains an sRGB/hex adapter over the OKLCH palette engine. Alpha
* is preserved separately and re-attached on commit so adjusting hue or
* brightness cannot change transparency.
*/
function themePickerAlphaSuffix(value: string): string {
const trimmed = value.trim().toLowerCase();
const alpha = /^#[0-9a-f]{4}$/.test(trimmed)
? trimmed.slice(4).repeat(2)
: /^#[0-9a-f]{8}$/.test(trimmed)
? trimmed.slice(7)
: "";
const normalized = themeColorToHex(value) ?? "";
const alpha = normalized.length === 9 ? normalized.slice(7) : "";
return alpha === "ff" ? "" : alpha;
}

function normalizeThemePickerColor(value: string): string {
const trimmed = value.trim();
if (/^#[0-9a-f]{3}$/i.test(trimmed)) {
return `#${trimmed
.slice(1)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{4}$/i.test(trimmed)) {
return `#${trimmed
.slice(1, 4)
.split("")
.map((character) => `${character}${character}`)
.join("")}`;
}
if (/^#[0-9a-f]{6}$/i.test(trimmed)) return trimmed;
if (/^#[0-9a-f]{8}$/i.test(trimmed)) return trimmed.slice(0, 7);
return "#000000";
return (themeColorToHex(value) ?? "#000000").slice(0, 7);
}

function themeHexToHsv(hex: string): ThemeColorHsv {
Expand DownExpand Up@@ -505,6 +484,9 @@ export const ThemeColorField = memo(function ThemeColorField({
const label = customLabel ?? getThemeRoleLabel(role);
const isColorValue = isThemeColor(value);
const swatchValue = isColorValue ? value : "#000000";
const editorValue = value.trim().toLowerCase().startsWith("oklch(")
? (themeColorToHex(value) ?? value)
: value;

return (
<div
Expand DownExpand Up@@ -542,7 +524,7 @@ export const ThemeColorField = memo(function ThemeColorField({
onPointerDown={() => onSelect?.(role)}
size="sm"
unstyled
value={value}
value={editorValue}
/>
</div>
</div>
Expand Down
Loading
Loading