Skip to content

Improve Sixel colour quality and recognize MudForge graphics - #85

Merged
HarryCordewener merged 1 commit into
mainfrom
codex/mudforge-graphics-refinement
Nov 7, 2026
Merged

HarryCordewener merged 1 commit into
mainfrom
codex/mudforge-graphics-refinement

Conversation

@HarryCordewener

@HarryCordewener HarryCordewener commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

MudForge reports MUDFORGE but does not forward terminal-query replies. Recognize its live-verified still iTerm2 and Sixel support without opting the player into graphics or claiming animation/Kitty support.

Replace Sixel's fixed 216-colour cube with an adaptive 255-colour palette, reusing GIF's existing bounded median-cut implementation. GIF behaviour is unchanged; transparency retains its reserved index. The grayscale round-trip regression failed with average channel error 12.6875 before the change and passes a threshold below 3 afterward. Existing round-trip tests now check decoded colours and transparency independently of palette slot numbers.

Validation: all 1,594 MarkupString tests pass. Independent static review found no actionable issues. Live MudForge placement investigation also confirmed an unrelated client DPI bug: its generic canvas correction divides the image addon's already-CSS-sized canvas by DPR; temporarily correcting that layer places repeated iTerm2 images correctly. This PR does not compensate server output for that client bug.

Release these packages together; SharpMUSH needs a subsequent package-version update to consume the profile and palette changes.

Summary by CodeRabbit

  • New Features
    • Added support for recognizing the MudForge terminal profile, including its inline-image and Sixel capabilities.
    • Sixel images now use an adaptive palette of up to 255 colors, improving color representation, including subtle shades.
  • Documentation
    • Added details about MudForge support and Sixel color handling, including known limitations of the web client.
  • Tests
    • Expanded checks for Sixel color accuracy, transparency, and MudForge terminal recognition.

@coderabbitai

coderabbitai Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

Walkthrough

GIF and Sixel encoding now share an adaptive median-cut palette implementation. Sixel tests validate decoded colors and grey-shade accuracy. The changes also add and document the MudForge terminal profile.

Changes

Adaptive image palettes

Layer / File(s) Summary
Shared palette generation
MarkupString.Ansi/Emitters/PicturePalette.cs
Adds RGB binning and weighted median-cut palette generation, returning palette colors and a bin-to-index lookup.
GIF and Sixel palette integration
MarkupString.Ansi/Emitters/GifWriter.cs, MarkupString.Ansi/Emitters/SixelWriter.cs, MarkupString.Tests/Ansi/TerminalFeatureTests.cs, MarkupString.Tests/Decoding/PictureDecodingTests.cs, MarkupString.Ansi/README.md
Both encoders use the shared palette. Sixel emits adaptive color definitions. Tests check decoded colors, transparency, and grey-shade accuracy. The README describes the palette behavior.

MudForge terminal profile

Layer / File(s) Summary
Profile registration and recognition
MarkupString.Ansi/TerminalProfile.cs, MarkupString.Ansi/PublicAPI.Unshipped.txt, MarkupString.Tests/Ansi/TerminalProfileTests.cs, MarkupString.Ansi/README.md
Adds the MudForge profile with inline-image, Sixel, and block-art features, registers it as a known profile, and tests recognition of its reported names. The README describes the profile and its stated constraints.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • SharpMUSH/MarkupString#80: Adds the Sixel decoding and round-trip behavior that this PR’s adaptive Sixel palette output and tests build on.
Merge Risk: Low · up to ff4b7

MudForge players will not get clickable links, because the profile omits hyperlink support. The new documentation is also hard to find because it sits under the Licence heading. Both are small fixes, and nothing else here blocks merging.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@HarryCordewener
HarryCordewener merged commit 07cf64e into main Nov 7, 2026
8 of 9 checks passed
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