Repository navigation
feat(themes): theme CSS can hold 50,000 characters - #36653
Closed
pouyarezvani wants to merge 1 commit into
Closed
pouyarezvani wants to merge 1 commit into
pouyarezvani wants to merge 1 commit into
Conversation
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>
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. |
Contributor
ApprovabilityVerdict: Approved at 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_setand the server all refuse the theme. Details are in #36650.Closes #36650.
Change
THEME_CSS_MAX_LENGTHinpackages/contracts/src/server.tsgoes from 20,000 to 50,000 characters. The theme schema,t3_theme_set, and the web theme editor and import all read this constant.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.packages/shared/src/themeCss.tsstates 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.tscould 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 unchangedmainas well, so I am leaving those to CI.Written by Claude Opus 5.5 in Claude Code, running inside T3 Code.
🤖 Generated with Claude Code