mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6827] [CLOSED] feat(theme): add token-based theme customisation with presets and appearance drawer #6468
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6468
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6827
Author: @rqzbeh
Created: 10/14/2026
Status: ❌ Closed
Base:
main← Head:feat/theme-customization📝 Commits (2)
572643afeat(theme): add token-based theme customisation with presets and appearance drawer5e3f1f4fix(theme): use message.useMessage() hook, restore light contrast tokens, and parameterise host cards📊 Changes
11 files changed (+981 additions, -151 deletions)
View changed files
➕
frontend/src/components/ui/AppearanceDrawer.tsx(+318 -0)📝
frontend/src/hooks/useTheme.tsx(+118 -147)📝
frontend/src/layouts/AppSidebar.css(+28 -0)📝
frontend/src/layouts/AppSidebar.tsx(+22 -0)➕
frontend/src/lib/themes/engine.ts(+218 -0)➕
frontend/src/lib/themes/index.ts(+2 -0)➕
frontend/src/lib/themes/presets.ts(+109 -0)➕
frontend/src/schemas/forms/theme.ts(+38 -0)📝
frontend/src/styles/page-cards.css(+4 -4)➕
frontend/src/test/theme-engine.test.tsx(+84 -0)➕
frontend/src/test/theme-schema.test.ts(+40 -0)📄 Description
Summary
Adds a token-based theme customization system driving both Ant Design 5's
ConfigProviderand CSS custom properties (--bg-page,--bg-card,--card-radius,--card-shadow,--card-accent-opacity) from a single source of truth. Includes 6 built-in presets (including a "Classic 2.x Inspired" preset), live accent color and border radius adjustments, density toggles, and JSON import/export.Why
Users moving to 3x-ui v3 often miss the high-density, flat aesthetic of v2.x, or want customized palettes (such as Nord or Dracula) without breaking the panel layout or requiring arbitrary CSS hacks. This provides a strictly validated, token-based presentation layer that keeps all v3 features styled consistently.
Type of change
Areas affected
How was this tested?
npx vitest run src/test/theme-schema.test.tsnpx vitest run src/test/theme-engine.test.tsxnpm run typecheck(tsc --noEmitpassed with 0 errors)npm run lint(oxlintpassed with 0 warnings and 0 errors)npm run format:check(oxfmt --checkpassed)Screenshots / recordings
N/A (Drawer accessible via the palette icon in the sidebar).
Breaking changes
None. Fully backwards-compatible with existing
useTheme()consumers (isDark,isUltra,toggleTheme,toggleUltra,buildAntdThemeConfig). Automatically migrates legacydark-modeandisUltraDarkThemeEnabledlocalStorage keys.Checklist
npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.