Skip to content

Feature: message styling IPC for per-message background, fade and hide#188

Open
Shuro wants to merge 1 commit into
Infiziert90:mainfrom
Shuro:feature/message-styling-ipc
Open

Feature: message styling IPC for per-message background, fade and hide#188
Shuro wants to merge 1 commit into
Infiziert90:mainfrom
Shuro:feature/message-styling-ipc

Conversation

@Shuro

@Shuro Shuro commented Jul 4, 2026

Copy link
Copy Markdown

Implements the styling IPC proposed in #186.

Two gates, following the typing IPC conventions:

  • ChatTwo.StyleVersion -> int (1)
  • ChatTwo.SetMessageStyleProvider(string gateName) - registers a provider gate owned by the calling plugin, empty string unregisters, one provider at a time.

The provider is called once per incoming message on the message processing thread and returns (uint BackgroundRgba, float Alpha). Style is stamped on the Message at ingestion (not persisted - history from older sessions renders unstyled, no DB change). Provider errors fall back to unstyled.

Rendering:

  • Table layout: whole-row tint via TableSetBgColor(RowBg0) (composes with the checkerboard PR Feature: checkerboard rows option for the modern layout #187 - explicit row colors take priority over RowBg alternation).
  • Classic layout: the text is drawn into the upper draw list channel and the rect is filled behind it afterwards, so the background matches the actual wrapped extent from the first frame. The split is merged in a finally so a draw exception can't leave the list split.
  • Fade: one style-alpha push around the message (text, links, icons).
  • Hide: render-only skip - the message stays in the database, exports and the web UI. Skipped before duplicate collapsing so a hidden message can't become the anchor of a collapse run.

StyleIpc is constructed before IpcManager so the gates already exist when the ChatTwo.Available broadcast triggers consumer re-registration.

ipc.md gained a "Message Styling IPC" section with the full contract (signature, threading, alpha semantics) and a consumer example.

Tested in game (with a test provider plugin)

  • background/fade/hide in both layouts
  • wrapped messages
  • pop-out tabs
  • hidden messages still present
  • re-registration after a Chat 2 reload

Disclosure:
This was co-developed with AI assistance (Claude Code).
I've reviewed the code and tested it in game myself.

All in one Preview:
image

image

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.

1 participant