[GH-ISSUE #5321] [Feature]: Inline Character Name Coloring in Message Text #2939

Closed
opened 2026-10-21 05:58:10 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @ylli-selmani on GitHub (Aug 20, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5321

Originally assigned to: @SpicyMarinara on GitHub.

I'll be honest, i totally did this for myself already (or rather, vibecoded it with Professor Mari and Glm 5.2), but you still have to create a FR first, and all that, so... yeah. :) Please be gentle

What problem does this solve?

In multi-character roleplays or conversations, it can be hard to tell at a glance who's being referred to in the prose. Character names blend into the surrounding text, especially in long messages with multiple characters mentioned. The speaker header at the top of each message box already uses each character's assigned name color (including gradients), but that coloring doesn't carry over into the body text itself, so you lose that visual anchor the moment you start reading.

This is something the AI Dungeon extension "Dungeon Extension v2" solved really well, and I full-on stole the idea from it because it just makes the reading experience so much better.

Proposed solution

Add an opt-in toggle under Text Rules called "Color Character Names in Text" that, when enabled, automatically detects character names in message text and colors them using each character's assigned nameColor. This should support:

  • Gradient name colors: characters with gradient nameColor values get their gradient rendered inline, same as the speaker header
  • Name aliases: characters with nameAliases get all their aliases colored too, not just the primary name
  • Quote-awareness: names appearing inside dialogue quotes (wrapped in "Name") should NOT be colored, since they're spoken dialogue, already colored by dialogueColor and not narrative prose. A safety valve handles unmatched/stray quotes so coloring doesn't break partway through a message
  • A sub-toggle: "Force Solid Colors for Inline Names": when enabled, gradient name colors are replaced with the single brightest color stop extracted from the gradient (by perceived luminance), since gradient text in small inline contexts can be harder to read. The speaker header is unaffected by this and always uses the full gradient

Only characters that have been added to the chat are eligible for name coloring. It doesn't matter if they're currently enabled or disabled in the chat's character list, as long as they're present. Characters not added to the chat won't get their names colored even if their name appears in the text.

The coloring should work in both the markdown rendering path and the HTML rendering path, and should not interfere with paragraph spacing, text stroke, or the existing text shadow/halo applied to message content. Gradient name spans need filter: drop-shadow() instead of text-shadow (which breaks with background-clip: text), and the inherited WebkitTextStroke needs to be zeroed on gradient spans to avoid a visible inward border artifact.

Alternatives considered

  • Coloring all name occurrences including dialogue: rejected because it muddies the distinction between prose narration and spoken dialogue. Names in quotes should look like dialogue, not like the narrator calling them out.
  • Using only solid colors (no gradient support at all): rejected because it would be inconsistent with the speaker header, which already renders gradients. The sub-toggle exists for users who want the simpler look without removing the option entirely.
  • Single unified coloring function for both rendering paths: tried this first, but the markdown path renders React nodes (which don't pass through raw HTML tags) while the HTML path uses dangerouslySetInnerHTML. A single string-injection approach works for HTML but produces visible literal tags in the markdown path. Two path-appropriate functions is the correct architecture.
  • Support for a Persona's name and aliases appearing in-line was considered and even partially implemented, but removed as it required several... several extra edits in files and even DB, as Personas did not support the nameAliases field initially. Maybe as a future update.

Additional context

Inspired by the AI Dungeon extension Dungeon Extension v2, which does something similar and makes multi-character stories significantly more readable IMO.

The feature is entirely opt-in (off by default) and lives under the existing Text Rules settings section, so it doesn't change anything for users who don't want it.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • [] I DID NOT read this template and provide the requested details.

A few screenshots from my personal branch.

Technically not "mock-up" anymore, as it's already working, but same idea.

  • Showcase of gradient names, a single solid-color name, as well as support for name Aliases, set inside a charcters colors tab, right at the bottom.
    Image

  • Mobile view, with 'Force Solid Color' toggled on.
    Image

  • Name Aliases Ui inside Colors Tab
    Image

  • Mobile plus Light mode is... okay. Shadow on gradient's look a bit too strong. (maybe auto force solid color in light mode or something?)

Image

Settings Panel with Subtoggle for solid Colors
Image

Originally created by @ylli-selmani on GitHub (Aug 20, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5321 Originally assigned to: @SpicyMarinara on GitHub. I'll be honest, i totally did this for myself already (or rather, vibecoded it with Professor Mari and Glm 5.2), but you still have to create a FR first, and all that, so... yeah. :) Please be gentle ## What problem does this solve? In multi-character roleplays or conversations, it can be hard to tell at a glance who's being referred to in the prose. Character names blend into the surrounding text, especially in long messages with multiple characters mentioned. The speaker header at the top of each message box already uses each character's assigned name color (including gradients), but that coloring doesn't carry over into the body text itself, so you lose that visual anchor the moment you start reading. This is something the AI Dungeon extension "Dungeon Extension v2" solved really well, and I full-on stole the idea from it because it just makes the reading experience so much better. ## Proposed solution Add an opt-in toggle under Text Rules called "Color Character Names in Text" that, when enabled, automatically detects character names in message text and colors them using each character's assigned nameColor. This should support: - Gradient name colors: characters with gradient nameColor values get their gradient rendered inline, same as the speaker header - Name aliases: characters with nameAliases get all their aliases colored too, not just the primary name - Quote-awareness: names appearing inside dialogue quotes (wrapped in "Name") should NOT be colored, since they're spoken dialogue, already colored by dialogueColor and not narrative prose. A safety valve handles unmatched/stray quotes so coloring doesn't break partway through a message - A sub-toggle: "Force Solid Colors for Inline Names": when enabled, gradient name colors are replaced with the single brightest color stop extracted from the gradient (by perceived luminance), since gradient text in small inline contexts can be harder to read. The speaker header is unaffected by this and always uses the full gradient Only characters that have been added to the chat are eligible for name coloring. It doesn't matter if they're currently enabled or disabled in the chat's character list, as long as they're present. Characters not added to the chat won't get their names colored even if their name appears in the text. The coloring should work in both the markdown rendering path and the HTML rendering path, and should not interfere with paragraph spacing, text stroke, or the existing text shadow/halo applied to message content. Gradient name spans need filter: drop-shadow() instead of text-shadow (which breaks with background-clip: text), and the inherited WebkitTextStroke needs to be zeroed on gradient spans to avoid a visible inward border artifact. ## Alternatives considered - Coloring all name occurrences including dialogue: rejected because it muddies the distinction between prose narration and spoken dialogue. Names in quotes should look like dialogue, not like the narrator calling them out. - Using only solid colors (no gradient support at all): rejected because it would be inconsistent with the speaker header, which already renders gradients. The sub-toggle exists for users who want the simpler look without removing the option entirely. - Single unified coloring function for both rendering paths: tried this first, but the markdown path renders React nodes (which don't pass through raw <span> HTML tags) while the HTML path uses dangerouslySetInnerHTML. A single string-injection approach works for HTML but produces visible literal tags in the markdown path. Two path-appropriate functions is the correct architecture. - Support for a Persona's name and aliases appearing in-line was considered and even partially implemented, but removed as it required several... several extra edits in files and even DB, as Personas did not support the nameAliases field initially. Maybe as a future update. ## Additional context Inspired by the AI Dungeon extension Dungeon Extension v2, which does something similar and makes multi-character stories significantly more readable IMO. The feature is entirely opt-in (off by default) and lives under the existing Text Rules settings section, so it doesn't change anything for users who don't want it. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [] I DID NOT read this template and provide the requested details. ## A few screenshots from my personal branch. Technically not "mock-up" anymore, as it's already working, but same idea. - Showcase of gradient names, a single solid-color name, as well as support for name Aliases, set inside a charcters colors tab, right at the bottom. <img width="1681" height="237" alt="Image" src="https://github.com/user-attachments/assets/ce05ca43-2a23-4d82-9e3d-816884ffe94e" /> - Mobile view, with 'Force Solid Color' toggled on. <img width="275" height="401" alt="Image" src="https://github.com/user-attachments/assets/0626f1c4-335d-4938-a1d5-903e6b9149da" /> - Name Aliases Ui inside Colors Tab <img width="588" height="502" alt="Image" src="https://github.com/user-attachments/assets/3cdb665e-a33c-43d8-af9f-b47d346ff986" /> - Mobile plus Light mode is... okay. Shadow on gradient's look a bit too strong. (maybe auto force solid color in light mode or something?) <img width="275" height="401" alt="Image" src="https://github.com/user-attachments/assets/1b2505b8-7fce-4876-a664-69a73fe482b5" /> Settings Panel with Subtoggle for solid Colors <img width="365" height="700" alt="Image" src="https://github.com/user-attachments/assets/3ac1829d-f13d-470e-bdb9-bdfbc9a625b8" />
Author
Owner

@SpicyMarinara commented on GitHub (Aug 20, 2026):

I think this is pretty cool, would love to have it! Thank you!

<!-- gh-comment-id:5358488893 --> @SpicyMarinara commented on GitHub (Aug 20, 2026): I think this is pretty cool, would love to have it! Thank you!
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#2939
No description provided.