Skip to content

feat(themes): theme CSS can hold 50,000 characters - #36653

Closed
pouyarezvani wants to merge 1 commit into
pingdotgg:mainfrom
pouyarezvani:feat/theme-css-limit-50k
Closed

pouyarezvani wants to merge 1 commit into
pingdotgg:mainfrom
pouyarezvani:feat/theme-css-limit-50k

Conversation

@pouyarezvani

Copy link
Copy Markdown
Contributor

Problem

First, thank you for theme CSS (#35247). It is GOATED. With one theme and no code changes I restyled nearly the whole app: one corner radius and border color across surfaces and menus, consistent inputs and buttons, Codex-style changed-files cards, recolored git status colors, swapped icons, and a matching font weight.

The only thing holding it back is the 20,000-character cap on a theme's CSS. That restyle is already about 15,500 characters with every comment and space stripped, and each embedded icon costs another 500 to 1,500, so the cap is close. Past it, the theme editor, t3_theme_set and the server all refuse the theme. Details are in #36650.

Closes #36650.

Change

  • THEME_CSS_MAX_LENGTH in packages/contracts/src/server.ts goes from 20,000 to 50,000 characters. The theme schema, t3_theme_set, and the web theme editor and import all read this constant.
  • In apps/server/src/environmentTheme.ts, the per-file cap goes from 32 KB to 80 KB and the total from 192 KB to 480 KB, so a theme with 50,000 characters of CSS still fits once it is JSON-encoded. Publishing checks the same per-file cap, so it still cannot write a file the watcher would skip.
  • The agent styling guide in packages/shared/src/themeCss.ts states the new limit and image size.

The CSS guard is unchanged: anything that could load a remote file is still dropped.

Scope

This raises a limit rather than fixing a crash, so it may fall outside the PR rules. #36650 shows the problem, and the matching request is in Ideas at #36651. Feel free to pick a different number, remove the cap, or close this in favor of your own change.

Verification

  • vp test run packages/shared/src/themeCss.test.ts apps/web/src/themePalette.test.ts packages/contracts/src/settings.test.ts: 3 files, 66 tests passed.
  • apps/server/src/environmentTheme.test.ts could not run locally. In a fresh checkout every Effect-based server test file fails to load with "Cannot read properties of undefined (reading 'config')", on unchanged main as well, so I am leaving those to CI.
  • Not checked: publishing a 50,000-character theme end to end in the app.

Written by Claude Opus 5.5 in Claude Code, running inside T3 Code.

🤖 Generated with Claude Code

A theme's custom CSS was capped at 20,000 characters. A theme that
restyles most of the app already needs about 15,500 characters with
comments and whitespace stripped, so the cap left little room.

THEME_CSS_MAX_LENGTH goes to 50,000. The server's per-theme-file cap
goes from 32 KB to 80 KB and the total from 192 KB to 480 KB, so a theme
with 50,000 characters of CSS still fits once JSON-encoded. The agent
styling guide states the new limit. The CSS guard is unchanged.

Closes pingdotgg#36650

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Closing: pouyarezvani already has 3 or more open PRs here, which is the limit for contributors who are not vouched.

Once one of them is merged or closed, open this again. See the open PR limit.

@github-actions github-actions Bot closed this Nov 14, 2026
@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Nov 14, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 2606da3

Macroscope's review found this PR approvable — Custom themes can now contain 50,000 CSS characters, with corresponding increases to bounded file and aggregate size limits. Existing validation and file-count safeguards remain unchanged, and default appearance is unaffected.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Theme CSS is capped at 20,000 characters, too small for a full restyle

1 participant