[PR #7297] [MERGED] fix(theme): keep colours set by HTML agent output when Chat Chrome Text Color is on #7671

Closed
opened 2026-10-24 04:06:22 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7297
Author: @SpicyMarinara
Created: 10/8/2026
Status: ✅ Merged
Merged: 10/8/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/chat-chrome-text-html-7296


📝 Commits (2)

  • bc4a8fb fix(theme): keep colours set by HTML agent output when Chat Chrome Text Color is on
  • c236a76 Merge origin/staging into fix/chat-chrome-text-html-7296

📊 Changes

5 files changed (+125 additions, -6 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 e2e/chat-widget-dialogue-colors.e2e.ts (+97 -0)
📝 packages/client/src/components/chat/ChatMessage.tsx (+4 -4)
📝 packages/client/src/lib/chat-widget-colors.ts (+3 -0)
📝 packages/client/src/styles/themes/chat-widget-surfaces.css (+20 -2)

📄 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.

Linked issue

Closes #7296

Why this change

Kakekay reported on Discord that the Immersive HTML agent draws a cream card with black text, but Marinara painted that text in their Chat Chrome Text Color (green in their screenshots, white by default), so the card became hard to read.

Root cause: the agent's output is fine. The bug is in the Engine. With Settings → Appearance → Chat widget style → Apply preset colors on, chat-widget-surfaces.css sets -webkit-text-fill-color on the message bubble to the preset text. Under the Default preset, that falls back to Chat Chrome Text Color. The fill is inherited and paints text instead of color. Author colors set with style="color:…", <font color> or a class from the message's own <style> only change color, so every element in the HTML painted the preset or chrome color. With the switch off, the chrome color never reaches messages, which is why only some users see this. This follows the same pattern as #7167, where a character's own dialogue color already wins over the preset.

What changed

  • ChatMessage.tsx: the HTML message wrapper gets a stable mari-html-content class. Its per-message scope class can't be targeted from CSS. Dialogue that the Engine colors with the fallback inside HTML messages is marked mari-fallback-dialogue (new FALLBACK_DIALOGUE_CLASS beside CHARACTER_COLOR_CLASS).
  • chat-widget-surfaces.css, when Apply preset colors is on:
    • .mari-html-content resets the fill to currentColor. Each element then paints its own color: inline, <font>, a class from the message's <style>, or a color inherited from a colored box. The wrapper's own color still comes from the preset, so text without a color of its own looks exactly as before.
    • Fallback dialogue inside HTML still follows the preset text, as it does in plain messages (#7167 decision unchanged).
    • With a gradient custom text color, inline and <font> colors in HTML skip the gradient. Uncolored text and uncolored dialogue keep it. A ponytail: note records the limits: a color set only by a class still gets the gradient, and text in a box with only a background color gets the solid first stop.
  • e2e/chat-widget-dialogue-colors.e2e.ts: a new test (dark and light) posts an Immersive-HTML-like message and sets Chat Chrome Text Color to the reporter's #6ab04c. Black text stays black (inherited from the card, inline, <font>, and a class from the message's <style>) with Apply preset colors off, then on with Default, Mari and Dottore, plus a gradient text color. Plain narration and uncolored dialogue keep following the preset. Under Default, the bubble uses the chrome color. Nothing changes after switching off again. Existing tests are unchanged; the shared fixture only gains one message, posted before the last one so the visual-novel check still sees the same latest message.
  • CHANGELOG entry under [Unreleased].

No UI copy changes. No docs changes: the docs already say Chat Chrome Text Color is for chat chrome, and Apply preset colors for messages, inputs and controls.

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

Agent-run checks (not a substitute for the boxes above):

  • pnpm check: exit 0.
  • The new test fails on unfixed staging (author black painted color(srgb 0.416 0.69 0.298 / 0.9), the chrome green at 90%, in dark and light) and passes with the fix.
  • e2e/chat-widget-dialogue-colors.e2e.ts + e2e/chat-widget-style.e2e.ts on desktop-chromium and mobile-webkit: all dialogue-color tests passed on both projects, including the new ones. In the full runs, two style tests failed once each, on different runs, because a fresh page stayed on "Loading..." (movable button pixel size … and chat style switches … dottore … dark). Neither involves HTML messages. Both passed on rerun on desktop-chromium and mobile-webkit, and the movable-button test also passed alone on unfixed staging.
  • Local CodeRabbit (coderabbit review --agent --committed): 0 findings.

Manual verification notes

  • Manually verify in a browser: in a Roleplay chat, post or generate an Immersive HTML message with a light card and black text (inline style="color:#000", <font color="#000000">, and a class from its own <style>).
  • Manually verify that with Settings → Appearance → App → Chat widget style → Apply preset colors on and the Default preset, setting Chat Chrome Text Color to green keeps the card text black. Plain narration, uncolored dialogue, names and the input placeholder should still turn green.
  • Manually verify the same with the Mari and Dottore presets, and with a gradient Text color in Chat widget style. Card text stays black, while uncolored text takes the preset or gradient.
  • Manually verify in both light and dark mode, and on a phone-width viewport.
  • Manually verify that a character with their own dialogue color still keeps it in HTML and plain messages, and that a character without one still follows the preset.
  • Manually verify that with Apply preset colors off nothing changes compared with staging.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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)

UI evidence (if applicable)

Measured in Chromium with Chat Chrome Text Color #6ab04c, Apply preset colors on, Default preset (computed color / -webkit-text-fill-color):

Element Before After
Inline / <font> / class / inherited black text rgb(0,0,0) / chrome green at 90% rgb(0,0,0) / rgb(0,0,0)
Plain narration in the same message chrome green chrome green (unchanged)
Uncolored dialogue chrome green chrome green (unchanged)

Credit: reported by Kakekay on Discord.


🔄 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/7297 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/8/2026 **Status:** ✅ Merged **Merged:** 10/8/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/chat-chrome-text-html-7296` --- ### 📝 Commits (2) - [`bc4a8fb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/bc4a8fbd3ee09fe217adcd5905cd7959d0851c1e) fix(theme): keep colours set by HTML agent output when Chat Chrome Text Color is on - [`c236a76`](https://github.com/Pasta-Devs/Marinara-Engine/commit/c236a7626265e1c2edbce010e94f788c274db74d) Merge origin/staging into fix/chat-chrome-text-html-7296 ### 📊 Changes **5 files changed** (+125 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `e2e/chat-widget-dialogue-colors.e2e.ts` (+97 -0) 📝 `packages/client/src/components/chat/ChatMessage.tsx` (+4 -4) 📝 `packages/client/src/lib/chat-widget-colors.ts` (+3 -0) 📝 `packages/client/src/styles/themes/chat-widget-surfaces.css` (+20 -2) </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. --> ## Linked issue Closes #7296 ## Why this change Kakekay reported on Discord that the Immersive HTML agent draws a cream card with black text, but Marinara painted that text in their **Chat Chrome Text Color** (green in their screenshots, white by default), so the card became hard to read. Root cause: the agent's output is fine. The bug is in the Engine. With **Settings → Appearance → Chat widget style → Apply preset colors** on, `chat-widget-surfaces.css` sets `-webkit-text-fill-color` on the message bubble to the preset text. Under the Default preset, that falls back to Chat Chrome Text Color. The fill is inherited and paints text instead of `color`. Author colors set with `style="color:…"`, `<font color>` or a class from the message's own `<style>` only change `color`, so every element in the HTML painted the preset or chrome color. With the switch off, the chrome color never reaches messages, which is why only some users see this. This follows the same pattern as #7167, where a character's own dialogue color already wins over the preset. ## What changed - `ChatMessage.tsx`: the HTML message wrapper gets a stable `mari-html-content` class. Its per-message scope class can't be targeted from CSS. Dialogue that the Engine colors with the fallback inside HTML messages is marked `mari-fallback-dialogue` (new `FALLBACK_DIALOGUE_CLASS` beside `CHARACTER_COLOR_CLASS`). - `chat-widget-surfaces.css`, when Apply preset colors is on: - `.mari-html-content` resets the fill to `currentColor`. Each element then paints its own color: inline, `<font>`, a class from the message's `<style>`, or a color inherited from a colored box. The wrapper's own `color` still comes from the preset, so text without a color of its own looks exactly as before. - Fallback dialogue inside HTML still follows the preset text, as it does in plain messages (#7167 decision unchanged). - With a gradient custom text color, inline and `<font>` colors in HTML skip the gradient. Uncolored text and uncolored dialogue keep it. A `ponytail:` note records the limits: a color set only by a class still gets the gradient, and text in a box with only a background color gets the solid first stop. - `e2e/chat-widget-dialogue-colors.e2e.ts`: a new test (dark and light) posts an Immersive-HTML-like message and sets Chat Chrome Text Color to the reporter's `#6ab04c`. Black text stays black (inherited from the card, inline, `<font>`, and a class from the message's `<style>`) with Apply preset colors off, then on with Default, Mari and Dottore, plus a gradient text color. Plain narration and uncolored dialogue keep following the preset. Under Default, the bubble uses the chrome color. Nothing changes after switching off again. Existing tests are unchanged; the shared fixture only gains one message, posted before the last one so the visual-novel check still sees the same latest message. - CHANGELOG entry under `[Unreleased]`. No UI copy changes. No docs changes: the docs already say Chat Chrome Text Color is for chat chrome, and Apply preset colors for messages, inputs and controls. ## 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` Agent-run checks (not a substitute for the boxes above): - `pnpm check`: exit 0. - The new test fails on unfixed staging (author black painted `color(srgb 0.416 0.69 0.298 / 0.9)`, the chrome green at 90%, in dark and light) and passes with the fix. - `e2e/chat-widget-dialogue-colors.e2e.ts` + `e2e/chat-widget-style.e2e.ts` on desktop-chromium and mobile-webkit: all dialogue-color tests passed on both projects, including the new ones. In the full runs, two style tests failed once each, on different runs, because a fresh page stayed on "Loading..." (`movable button pixel size …` and `chat style switches … dottore … dark`). Neither involves HTML messages. Both passed on rerun on desktop-chromium and mobile-webkit, and the movable-button test also passed alone on unfixed staging. - Local CodeRabbit (`coderabbit review --agent --committed`): 0 findings. ### Manual verification notes - Manually verify in a browser: in a Roleplay chat, post or generate an Immersive HTML message with a light card and black text (inline `style="color:#000"`, `<font color="#000000">`, and a class from its own `<style>`). - Manually verify that with Settings → Appearance → App → Chat widget style → **Apply preset colors** on and the **Default** preset, setting **Chat Chrome Text Color** to green keeps the card text black. Plain narration, uncolored dialogue, names and the input placeholder should still turn green. - Manually verify the same with the **Mari** and **Dottore** presets, and with a gradient **Text** color in Chat widget style. Card text stays black, while uncolored text takes the preset or gradient. - Manually verify in both light and dark mode, and on a phone-width viewport. - Manually verify that a character with their own dialogue color still keeps it in HTML and plain messages, and that a character without one still follows the preset. - Manually verify that with **Apply preset colors** off nothing changes compared with staging. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) 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) ## UI evidence (if applicable) Measured in Chromium with Chat Chrome Text Color `#6ab04c`, Apply preset colors on, Default preset (computed `color` / `-webkit-text-fill-color`): | Element | Before | After | | --- | --- | --- | | Inline / `<font>` / class / inherited black text | `rgb(0,0,0)` / chrome green at 90% | `rgb(0,0,0)` / `rgb(0,0,0)` | | Plain narration in the same message | chrome green | chrome green (unchanged) | | Uncolored dialogue | chrome green | chrome green (unchanged) | Credit: reported by Kakekay on Discord. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:22 +07:00
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#7671
No description provided.