[PR #8926] feat(ui): UI Editor, pick anything on screen and change how it looks #8885

Open
opened 2026-11-07 17:40:27 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8926
Author: @Promansis
Created: 11/7/2026
Status: 🔄 Open

Base: staging ← Head: feature(ui)/ui-element-style-editor


📝 Commits (10+)

  • 2c51bd7 feat(ui): pick an interface element to restyle it (#8874)
  • 3c70511 fix(ui): make every UI style region visibly restyle
  • 4666553 feat(ui): add Home, editor, game, menu, toast and text field style regions
  • 618254d feat(ui): edit a picked region in a floating card, with interface presets
  • 84ae94f feat(ui): restyle Engine blocks by their mari-* class from the picker
  • 4e7640c feat(ui): pick colours from a saturation square and hue strip
  • 0628d49 feat(ui): opacity strip and Custom/Palette tabs in the colour picker
  • 850abbd feat(ui): shared opacity bar under both colour picker tabs
  • d79042b feat(ui): border width, background blur and shadow in the style editor
  • b3df83d feat(ui): put UI Element Styles inside App Style

📊 Changes

21 files changed (+2998 additions, -372 deletions)

View changed files

📝 docs/appearance/appearance-settings.md (+10 -3)
📝 e2e/core-flows.e2e.ts (+8 -8)
📝 e2e/home-setup-cancel-loading.e2e.ts (+1 -1)
📝 packages/client/src/App.tsx (+12 -1)
📝 packages/client/src/components/chat/ConversationMessageLine.tsx (+1 -1)
📝 packages/client/src/components/chat/HomeBrowserHub.tsx (+1 -1)
📝 packages/client/src/components/game/GameWidgetSetupEditor.tsx (+1 -0)
➕ packages/client/src/components/layout/UiStyleEditorCard.tsx (+662 -0)
➕ packages/client/src/components/layout/UiStyleOverridesInjector.tsx (+298 -0)
📝 packages/client/src/components/panels/SettingsPanel.tsx (+4 -27)
➕ packages/client/src/components/panels/settings/UiStyleSettings.tsx (+296 -0)
📝 packages/client/src/components/ui/ColorPicker.tsx (+501 -314)
📝 packages/client/src/components/ui/ContextMenu.tsx (+2 -2)
📝 packages/client/src/hooks/use-settings-sync.ts (+21 -0)
📝 packages/client/src/lib/css-colors.ts (+79 -0)
📝 packages/client/src/lib/settings-registry.ts (+19 -7)
📝 packages/client/src/lib/ui-persistence.ts (+1 -1)
➕ packages/client/src/lib/ui-style-overrides.ts (+538 -0)
📝 packages/client/src/localization/locales/en.json (+94 -3)
📝 packages/client/src/stores/ui.store.ts (+85 -3)

...and 1 more files

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

TL;DR: Adds UI Editor to App Style. Pick anything on screen, or choose it from a list, and change its colours, border, corners, opacity, text size, blur and shadow, with a live preview and Save/Revert. Whole app replaces the old Background Color setting.

Linked issue

Closes #8925

Why this change

"I want the top bar darker and my own message bubbles rounder. Where do I change that?"

Today the only options are a full CSS theme or the tracker Card Colors editor. Restyling one part of the app means writing CSS against selectors that aren't documented and can change between releases. The UI Editor lets anyone point at a part and change it, and saved styles keep working because they only target named regions and the Engine's own mari-* classes.

What changed

  • UI Editor row in Settings → Appearance → App Style (UiStyleSettings.tsx), searchable as "UI Editor", "edit ui", "customize ui" and "pick on screen". It has Pick on screen, a Choose what to change… list, a What you've changed list with reset per part, presets, and Copy a look from….
  • Pick overlay (UiStyleOverridesInjector.tsx): hover highlights and a click or tap picks. Wheel and touch scrolling still work while picking, Escape or Cancel leaves, and phones get their own hint text.
  • Floating edit card (UiStyleEditorCard.tsx):
    • It sits next to the picked element. On phones it docks at the top or bottom, whichever keeps the element visible.
    • A breadcrumb chooses the reach: region › block › element. The label says how much it covers, for example "Changes all 42 here, and on other screens".
    • Editable properties: background (colour or gradient), text colour, border colour and width, corners, opacity, text size, background blur and shadow.
    • With a chat open, choosing Whole app shows a hint with a one-tap "Style the chat area instead".
  • lib/ui-style-overrides.ts:
    • It holds the region registry and normalises the synced settings blob, which is the trust boundary: unknown ids, invalid mari-* classes and hostile colour strings are dropped, and numbers are clamped.
    • It builds the CSS (:root-prefixed !important), maps a pick to its region and blocks, and stores presets.
    • The editor never restyles itself: rules use a zero-specificity :where(:not([data-ui-style-editor] …)) guard.
  • Background Color removed. Whole app replaces it, and persist v104→105 moves a saved value into Whole app. Values it can't fold in, such as url(...) or over-long strings, stay in appBackgroundColor, and App.tsx still paints them.
  • Shared ColorPicker reworked: a saturation square, hue strip and opacity strip, plus Custom/Palette tabs. Gradients start from the current colour.
  • mari-* markers added where blocks lacked one: ContextMenu (both the popover and the bottom sheet), ConversationMessageLine, HomeBrowserHub and GameWidgetSetupEditor.
  • Store and sync: uiStyleOverrides and uiStylePresets are persisted and synced, normalised on both persist merge and settings sync, and cleared by Reset appearance.
  • Docs and copy: docs/appearance/appearance-settings.md now describes the app background through Whole app. New English strings are in en.json. The e2e specs that used the removed Background Color setter are updated.
  • Regression test: scripts/regressions/ui-style-overrides.regression.ts covers:
    • exact CSS output;
    • hostile-value rejection;
    • clamping;
    • key-order-independent serialisation;
    • pick resolution;
    • the editor guard;
    • the Background Color migration.

Known compatibility note: a client from before this change still shows the old Background Color field. Edits made there while a new client is also in use are lost.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Automated results (agent-run, on a12458953d):

  • pnpm check: exit 0.
  • pnpm localization:check: exit 0.
  • node scripts/run-regressions.mjs --filter scripts/regressions/ui-style-overrides.regression.ts: passed.
  • Earlier on the branch: theme-css-security, seasonal-themes, omnibar-settings-sync, chat-widget-style-persistence and other regressions passed.
  • Not run: pnpm smoke:ui, container build.

Manual verification notes

  • Manually verify that a Background Color saved before this change shows up in UI Editor → Whole app, and that the app background looks the same.
  • Manually verify Pick on screen on desktop: hover highlight, click to pick, Escape and Cancel leave, and the clicked button's own action does not fire.
  • Manually verify Pick on screen at 390 px: tap to pick, scroll while picking, and the card docks without covering the picked part.
  • Manually verify the live preview, Save and Revert, and Reset to default for a region (for example Top bar) and for a block (for example Small buttons).
  • Manually verify that restyling Buttons or Small buttons leaves the editor's own buttons unchanged.
  • Manually verify that the Whole app hint and "Style the chat area instead" appear with a chat open, and not on Home.
  • Manually verify that presets save, apply and reset, and that Copy a look from… copies one part to another.
  • Manually verify light and dark mode, and that Reset appearance clears UI Editor styles.
  • Manually verify that the right-click menu still opens as a popover on desktop and as a bottom sheet on phones.
  • Manually verify that a new user notices Pick on screen. In both S.O.U.P. walkthroughs, every persona used the list instead.

Known open phone issues (not fixed in this PR):

  • The card can cover the lower part of the More menu.
  • Landscape phones leave little room for the card.
  • Some touch targets are under 44 px.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

docs/appearance/appearance-settings.md changed. Follow-up: #8927.

UI evidence (if applicable)

image image chrome_dtONxJmXsW image image image image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8926 **Author:** [@Promansis](https://github.com/Promansis) **Created:** 11/7/2026 **Status:** 🔄 Open **Base:** `staging` ← **Head:** `feature(ui)/ui-element-style-editor` --- ### 📝 Commits (10+) - [`2c51bd7`](https://github.com/Pasta-Devs/Marinara-Engine/commit/2c51bd765326caf7b90883cf8ee16b8f45c8292b) feat(ui): pick an interface element to restyle it (#8874) - [`3c70511`](https://github.com/Pasta-Devs/Marinara-Engine/commit/3c70511862c58f8579867bf99861fa1b6dcb736b) fix(ui): make every UI style region visibly restyle - [`4666553`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4666553326496732d0f0bf23331064a137dfe451) feat(ui): add Home, editor, game, menu, toast and text field style regions - [`618254d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/618254d6e5b0ec46dd5cdd685d9c83c8f46f19db) feat(ui): edit a picked region in a floating card, with interface presets - [`84ae94f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/84ae94f781b6f792a4ca7e76540a1809567b018e) feat(ui): restyle Engine blocks by their mari-* class from the picker - [`4e7640c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4e7640cc81db562228b83af7d3cf9f507224daa8) feat(ui): pick colours from a saturation square and hue strip - [`0628d49`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0628d49e9010b8ee905afdea93628c08887a55f7) feat(ui): opacity strip and Custom/Palette tabs in the colour picker - [`850abbd`](https://github.com/Pasta-Devs/Marinara-Engine/commit/850abbd38451bff0385a557fa8d5962dd80eaa09) feat(ui): shared opacity bar under both colour picker tabs - [`d79042b`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d79042b3922ef69c4570b30436414257494c265c) feat(ui): border width, background blur and shadow in the style editor - [`b3df83d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b3df83d184048f025f1234bd8c19a6e5e3cdee13) feat(ui): put UI Element Styles inside App Style ### 📊 Changes **21 files changed** (+2998 additions, -372 deletions) <details> <summary>View changed files</summary> 📝 `docs/appearance/appearance-settings.md` (+10 -3) 📝 `e2e/core-flows.e2e.ts` (+8 -8) 📝 `e2e/home-setup-cancel-loading.e2e.ts` (+1 -1) 📝 `packages/client/src/App.tsx` (+12 -1) 📝 `packages/client/src/components/chat/ConversationMessageLine.tsx` (+1 -1) 📝 `packages/client/src/components/chat/HomeBrowserHub.tsx` (+1 -1) 📝 `packages/client/src/components/game/GameWidgetSetupEditor.tsx` (+1 -0) ➕ `packages/client/src/components/layout/UiStyleEditorCard.tsx` (+662 -0) ➕ `packages/client/src/components/layout/UiStyleOverridesInjector.tsx` (+298 -0) 📝 `packages/client/src/components/panels/SettingsPanel.tsx` (+4 -27) ➕ `packages/client/src/components/panels/settings/UiStyleSettings.tsx` (+296 -0) 📝 `packages/client/src/components/ui/ColorPicker.tsx` (+501 -314) 📝 `packages/client/src/components/ui/ContextMenu.tsx` (+2 -2) 📝 `packages/client/src/hooks/use-settings-sync.ts` (+21 -0) 📝 `packages/client/src/lib/css-colors.ts` (+79 -0) 📝 `packages/client/src/lib/settings-registry.ts` (+19 -7) 📝 `packages/client/src/lib/ui-persistence.ts` (+1 -1) ➕ `packages/client/src/lib/ui-style-overrides.ts` (+538 -0) 📝 `packages/client/src/localization/locales/en.json` (+94 -3) 📝 `packages/client/src/stores/ui.store.ts` (+85 -3) _...and 1 more files_ </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> **TL;DR:** Adds **UI Editor** to App Style. Pick anything on screen, or choose it from a list, and change its colours, border, corners, opacity, text size, blur and shadow, with a live preview and Save/Revert. Whole app replaces the old Background Color setting. ## Linked issue Closes #8925 ## Why this change > "I want the top bar darker and my own message bubbles rounder. Where do I change that?" Today the only options are a full CSS theme or the tracker Card Colors editor. Restyling one part of the app means writing CSS against selectors that aren't documented and can change between releases. The UI Editor lets anyone point at a part and change it, and saved styles keep working because they only target named regions and the Engine's own `mari-*` classes. ## What changed - **UI Editor row** in Settings → Appearance → App Style (`UiStyleSettings.tsx`), searchable as "UI Editor", "edit ui", "customize ui" and "pick on screen". It has **Pick on screen**, a **Choose what to change…** list, a **What you've changed** list with reset per part, presets, and Copy a look from…. - **Pick overlay** (`UiStyleOverridesInjector.tsx`): hover highlights and a click or tap picks. Wheel and touch scrolling still work while picking, Escape or Cancel leaves, and phones get their own hint text. - **Floating edit card** (`UiStyleEditorCard.tsx`): - It sits next to the picked element. On phones it docks at the top or bottom, whichever keeps the element visible. - A breadcrumb chooses the reach: region › block › element. The label says how much it covers, for example "Changes all 42 here, and on other screens". - Editable properties: background (colour or gradient), text colour, border colour and width, corners, opacity, text size, background blur and shadow. - With a chat open, choosing Whole app shows a hint with a one-tap "Style the chat area instead". - **`lib/ui-style-overrides.ts`**: - It holds the region registry and normalises the synced settings blob, which is the trust boundary: unknown ids, invalid `mari-*` classes and hostile colour strings are dropped, and numbers are clamped. - It builds the CSS (`:root`-prefixed `!important`), maps a pick to its region and blocks, and stores presets. - The editor never restyles itself: rules use a zero-specificity `:where(:not([data-ui-style-editor] …))` guard. - **Background Color removed.** Whole app replaces it, and persist v104→105 moves a saved value into Whole app. Values it can't fold in, such as `url(...)` or over-long strings, stay in `appBackgroundColor`, and App.tsx still paints them. - **Shared ColorPicker reworked**: a saturation square, hue strip and opacity strip, plus Custom/Palette tabs. Gradients start from the current colour. - **`mari-*` markers** added where blocks lacked one: `ContextMenu` (both the popover and the bottom sheet), `ConversationMessageLine`, `HomeBrowserHub` and `GameWidgetSetupEditor`. - **Store and sync**: `uiStyleOverrides` and `uiStylePresets` are persisted and synced, normalised on both persist `merge` and settings sync, and cleared by **Reset appearance**. - **Docs and copy**: `docs/appearance/appearance-settings.md` now describes the app background through Whole app. New English strings are in `en.json`. The e2e specs that used the removed Background Color setter are updated. - **Regression test**: `scripts/regressions/ui-style-overrides.regression.ts` covers: - exact CSS output; - hostile-value rejection; - clamping; - key-order-independent serialisation; - pick resolution; - the editor guard; - the Background Color migration. **Known compatibility note:** a client from before this change still shows the old Background Color field. Edits made there while a new client is also in use are lost. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` **Automated results (agent-run, on `a12458953d`):** - `pnpm check`: exit 0. - `pnpm localization:check`: exit 0. - `node scripts/run-regressions.mjs --filter scripts/regressions/ui-style-overrides.regression.ts`: passed. - Earlier on the branch: theme-css-security, seasonal-themes, omnibar-settings-sync, chat-widget-style-persistence and other regressions passed. - Not run: `pnpm smoke:ui`, container build. ### Manual verification notes - Manually verify that a Background Color saved before this change shows up in UI Editor → Whole app, and that the app background looks the same. - Manually verify Pick on screen on desktop: hover highlight, click to pick, Escape and Cancel leave, and the clicked button's own action does not fire. - Manually verify Pick on screen at 390 px: tap to pick, scroll while picking, and the card docks without covering the picked part. - Manually verify the live preview, Save and Revert, and Reset to default for a region (for example Top bar) and for a block (for example Small buttons). - Manually verify that restyling Buttons or Small buttons leaves the editor's own buttons unchanged. - Manually verify that the Whole app hint and "Style the chat area instead" appear with a chat open, and not on Home. - Manually verify that presets save, apply and reset, and that Copy a look from… copies one part to another. - Manually verify light and dark mode, and that Reset appearance clears UI Editor styles. - Manually verify that the right-click menu still opens as a popover on desktop and as a bottom sheet on phones. - Manually verify that a new user notices Pick on screen. In both S.O.U.P. walkthroughs, every persona used the list instead. **Known open phone issues (not fixed in this PR):** - The card can cover the lower part of the More menu. - Landscape phones leave little room for the card. - Some touch targets are under 44 px. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) `docs/appearance/appearance-settings.md` changed. Follow-up: #8927. ## UI evidence (if applicable) <img width="278" height="239" alt="image" src="https://github.com/user-attachments/assets/f7a38433-2463-4ee3-83ef-6380d4e415db" /> <img width="1920" height="911" alt="image" src="https://github.com/user-attachments/assets/b4ce949b-83bc-4515-8146-38e1fefc3b97" /> <img width="1920" height="911" alt="chrome_dtONxJmXsW" src="https://github.com/user-attachments/assets/3a391204-e855-4ee9-a33d-c4b0f06d38d7" /> <img width="396" height="580" alt="image" src="https://github.com/user-attachments/assets/2f0ab399-bab3-4933-8f97-57eb14e744c6" /> <img width="348" height="732" alt="image" src="https://github.com/user-attachments/assets/1be72299-572a-4785-82eb-7a115397f920" /> <img width="348" height="730" alt="image" src="https://github.com/user-attachments/assets/51e058e6-e972-4560-8884-856c54b9c140" /> <img width="1920" height="911" alt="image" src="https://github.com/user-attachments/assets/c632e5fe-8ebf-4cf9-9292-e2c394de1814" /> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8885
No description provided.