Skip to content

Studio: add customizable chat background images and effects - #15973

Merged
shimmyshimmer merged 15 commits into
unslothai:mainfrom
wasimysaid:feat/studio-workspace-wallpaper
Oct 30, 2026
Merged

shimmyshimmer merged 15 commits into
unslothai:mainfrom
wasimysaid:feat/studio-workspace-wallpaper

Conversation

@wasimysaid

@wasimysaid wasimysaid commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Adds local background images to Studio's chat page through Appearance settings. The sidebar keeps its normal surface, the image crop stays fixed when opening it, and the chat header blends into the artwork. Conversations receive stronger contrast protection than the welcome screen.

  • Upload, replace, or remove a JPEG, PNG, or WebP image; adjust visibility, blur, and position, with live previews and reset controls.
  • Choose None, Dither, ASCII, Halftone, or Scanlines. Effects run in a worker and reuse cached results; slider and layout changes do not rerun image processing.
  • Backgrounds are chat-only by default. Set BACKGROUND_ON_ALL_PAGES to true in features/chat-background/model.ts to restore them across main workspace pages; the shared renderer and page styles remain available.
  • Store images and preferences locally per account, with upload validation, persistence recovery, reduced-motion support, and translations across all 14 locales.

Validation: production build/typecheck, startup bundle budget, strict locale parity, feature ESLint, and seven unit tests pass. Appearance regression compares 1,600 effect outputs against saved reference digests. Browser regression covers effects, persistence, invalid uploads, storage failure recovery, rapid changes, theme switching, conversation contrast, reduced motion, mobile layout, sidebar crop stability, chat-only route visibility, account isolation, and reset. Native desktop appearance was reviewed through screenshots; automated browser coverage uses the backend-free smoke fixture.

@wasimysaid

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-30T11:04:01.167227Z
We couldn’t complete this review. Comment @codex review to try again.
fd362f0 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@wasimysaid wasimysaid changed the title Studio: add customizable workspace background images and effects Studio: add customizable chat background images and effects Oct 30, 2026
@shimmyshimmer

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Center the Remove background and Replace image actions on the section heading, keep a gap above the previews, give Remove the same hover wash as Replace, and top-align the background setting rows.
@shimmyshimmer
shimmyshimmer merged commit 694cac1 into unslothai:main Oct 30, 2026
3 of 47 checks passed
danielhanchen added a commit that referenced this pull request Oct 30, 2026
… guards (#16116)

#15973 (add customizable chat background images and effects) left 12
frontend unit tests red on main. Every PR's `Frontend unit tests` and
`Frontend build + bundle sanity` jobs fail on them, for example #16109,
#16110 and #16112. This fixes 11 of the 12. The last one is the titlebar
`:has()` on the document root, which needs a product change and goes in
its own PR.

## 1. General Settings token sync (9 tests)

```
not ok - an untouched General Settings tab adopts a token changed in another tab   (and 8 more in the file)
  error: 'no stub for import "@/features/chat-background" in .../settings/tabs/general-tab.tsx'
```

`general-tab.tsx` now imports `resetChatBackground` from
`@/features/chat-background` for Reset all preferences. The test's stub
map was one module behind, so this adds `"@/features/chat-background": {
resetChatBackground: async () => true }`.

## 2. Every page loads the polyfill (1 test)

```
smoke-chat-background.html must load /crypto-boot.js
```

The new smoke page skipped the `crypto.randomUUID` polyfill that every
other page loads before its module entry. It now carries the same
`<script src="/crypto-boot.js"></script>`.

## 3. Toasts and composers read one shadow variable (1 test)

```
:is([data-wallpaper-workspace], [data-chat-content-root]):has(> .chat-wallpaper[data-ready]) .unsloth-composer-surface, .wallpaper-preview-composer uses the shared shadow
  actual: 'inset 0 0 0 1px var(--border)'   expected: 'var(--composer-shadow)'
```

The wallpaper composer draws an outline instead of a drop shadow, which
is a deliberate design. It now sets that through the variable rather
than around it: `--composer-shadow: inset 0 0 0 1px var(--border);
box-shadow: var(--composer-shadow);`. The "Composer outline" off rule
sets `--composer-shadow: none`, and its `:has()` is more specific, so it
still wins. Nothing reading `--composer-shadow` sits inside the composer
surface, so the override reaches nothing else.

## Verification

- Frontend suite: on main, 12 failures across those four files. Here,
`general-settings-token-sync` 9/9, `crypto-uuid-boot` 4/4,
`toast-composer-shadow` 2/2 and `chat-background` 7/7 pass. The one
remaining failure is `titlebar-modal-layering`'s document-root `:has()`,
as described above.
- Rendering on `smoke-chat-background.html`, driven the way
`tests/studio/playwright_chat_background.js` drives it (reset, upload an
image, toggle Composer outline):
- Computed `box-shadow` of both preview composers and the live composer
is `oklch(0.9208 0 0) 0px 0px 0px 1px inset` with the outline on and
`none` with it off, on main and here alike.
- A screenshot pixel diff in the same tree, with only `index.css`
swapped, is 80 / 26 pixels for outline on / off. Main against main is 71
/ 26, so that is the run-to-run noise floor and there is no visible
change.

## Screenshots

Chat background settings with an uploaded image on this branch. Composer
outline on: the previews and the live composer keep the 1px outline.

![Composer outline
on](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16116/g_head_on_q-3049b6fa235e.png)

Composer outline off: no outline and no shadow, as on main.

![Composer outline
off](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16116/g_head_off_q-de3798d52bfb.png)
danielhanchen added a commit that referenced this pull request Oct 30, 2026
…l:has() (#16117)

The 12th frontend failure #15973 (customizable chat background images
and effects) left on main. #16116 fixes the other 11.

```
not ok - the titlebar dims for viewport backdrops without a :has() on the document root
  expected not to match /(?:^|[\s,{}(>~+])(?:html|body|:root)...:has\(/
```

To clear the Desktop titlebar over a ready wallpaper, #15973 added four
rules of the form `html:has(:is([data-wallpaper-workspace],
[data-chat-content-root]) > .chat-wallpaper[data-ready])
[data-slot="window-titlebar"] ...`. The titlebar renders outside the
wallpaper's subtree, so a plain descendant selector cannot reach it. A
`:has()` whose subject is the document root, though, makes every DOM
mutation anywhere a candidate for re-matching. That is why
`titlebar-modal-layering` forbids it, and why the viewport-backdrop
dimming next to it goes through a store and an attribute instead.

Here the product needed the change, not the test.

## Change

- `ChatBackground` sets `data-chat-wallpaper-ready` on `<html>` while
the app's own wallpaper is ready, plus
`data-chat-wallpaper-workspace-ready` when it sits in the workspace. The
marks are reference-counted and removed when the wallpaper unmounts,
deactivates or loses its frame.
- The check reads the wallpaper's direct parent, the same `>
.chat-wallpaper` relation the old selectors used. So the settings
previews never mark the root, just as they never matched before.
- The four rules now key off `html[data-chat-wallpaper-ready]` and
`html[data-chat-wallpaper-workspace-ready]`. They are still unlayered,
so they keep beating the titlebar's Tailwind utilities. The
pinned-sidebar segment rule stays more specific than the
transparent-controls rule, so it still wins.
- `titlebar-modal-layering` matched `data-slot="window-titlebar"`
immediately followed by `data-viewport-backdrop-open=`, and #15973 had
put `data-wallpaper-sidebar-pinned` between them. The pattern now allows
other attributes inside the same opening tag.

## Verification

- `tests/titlebar-modal-layering.test.ts` and
`tests/chat-background.test.ts`: 12 passed. On main the titlebar case
fails.
- Sabotage: restoring main's `index.css` fails the root `:has()` check,
and dropping `data-viewport-backdrop-open` from the titlebar fails the
attribute check.
- Behaviour. The titlebar only renders in the Desktop app on Windows and
Linux, so I measured it rather than screenshotting it. On
`smoke-chat-background.html` I added stand-in `window-titlebar` (sidebar
pinned, two `data-wallpaper-chrome-controls`) and
`window-titlebar-decoration` elements, with base styles in `@layer
utilities` like the real classes. Computed styles, main and this branch
alike:

| State | titlebar bg / backdrop-filter | first controls (pinned
sidebar) bg | other controls bg / backdrop-filter | decoration |
`<html>` marks (branch) |
|---|---|---|---|---|---|
| no wallpaper | red / blur(4px) | red | red / blur(4px) | visible |
none |
| wallpaper ready | transparent / none | `rgb(255, 255, 255)`
(`--sidebar`) | transparent / none | hidden | ready, workspace-ready |
| after Reset all | red / blur(4px) | red | red / blur(4px) | visible |
none |

Text shadow on the controls also matches (`rgb(254, 254, 253) 0px 1px
8px` when ready).
- Full frontend suite: the only failures left are the 11 that #16116
fixes. `tsc --noEmit -p tsconfig.app.json` is clean.
danielhanchen added a commit that referenced this pull request Nov 7, 2026
Fixes #17004

## Problem

With a background image on, opening a model from the Model hub drew its
page on top of the hub feed: carousel cards, "Latest Unsloth Models"
rows and README text and images all overlapped.

The model page is an overlay over the hub list (the full-width card
layout, and split view below 1024 px). It hid the list only by painting
`--background`, and the background image rule (#15973) clears
`.hub-canvas` fills, so the overlay became transparent and the list
showed through. macOS glass clears the same fill.

## Fix

- While a model page covers the list, the list pane is `visibility:
hidden` (`invisible`, or `max-lg:invisible` in split view, where the
list only sits under the page on narrow windows). The background image
still shows behind the model page as intended.
- The Discover / On Device scroll panes set an explicit `visible` on the
active pane, which would repaint it through a hidden ancestor. They now
only add `invisible` to the inactive pane, which is the same result
whenever nothing above them is hidden.

Without a background image nothing visible changes: the opaque overlay
already covered the list. Wide split view keeps the list visible beside
the page.

## Verification

Studio built from main and from this branch, background image set to all
pages, `unsloth/Qwen3-0.6B-GGUF` opened from the hub:

| View | main | this branch |
| --- | --- | --- |
| Two-column feed, 1600 px | 42 list items painted under the model page
| 0 |
| Split view, 900 px | 22 | 0 |
| Split view, 1600 px | list beside the page | unchanged |

Back to Hub shows the list again on both sides (scroll position behaves
as on main). `tests/hub-detail-hides-covered-catalog.test.ts` fails on
main and passes here; the frontend suite and `tsc --noEmit` pass.

## Before / after

Model hub, two-column feed, background image on all pages,
`unsloth/Qwen3-0.6B-GGUF` opened. Left (main): list rows and carousel
cards painted through the model page. Right (this branch): the model
page alone. The quantization row reads "Loading" on the right only
because the Hugging Face file listing had not returned yet when the shot
was taken.

![Model hub model page before and
after](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/17021/pr17021_before_after-97253e083316.png)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants