Skip to content

Tint floors drawn as red colour masks by default, like greyscale ones - #14

Closed
bularzik wants to merge 4 commits into
thekannen:mainfrom
bularzik:floor-tint-threshold
Closed

bularzik wants to merge 4 commits into
thekannen:mainfrom
bularzik:floor-tint-threshold

Conversation

@bularzik

Copy link
Copy Markdown
Contributor

Problem

build_room and place_pattern with no colour tint greyscale textures brown and leave coloured ones untinted. Some Simple Tiles textures, however, are red colour masks that the tile tools tint: tileset_wood_damaged, tileset_diamond, _diamond_2 and _ornate. The greyscale check sees red and leaves them untinted, which means a white tint, so a wood_damaged floor rendered white (#ffffff).

Change

  • _colour_stats measures:

    • coloured share: the fraction of opaque pixels with a channel spread over 0.08;
    • mean spread: the average spread of those pixels;
    • red share: the fraction of them that are mask red (red above green and blue, with green and blue equal within 0.08).

    _is_greyscale and _texture_is_greyscale keep today's decision through _greyscale_from.

  • _place_pattern with no colour also tints a texture _red_mask_from accepts: red share at least 0.9 and mean spread at least 0.4. Real colour textures stay untinted.

  • The reply gains texture_red_mask and texture_colour {coloured_share, mean_spread, red_share} next to texture_greyscale.

  • The place_pattern and build_room docstrings describe the rule. Wall-preview tinting is unchanged.

Measurements (core textures)

Texture coloured share mean spread red share
18 other Simple Tiles 0 0 0
tileset_diamond, _diamond_2, _ornate 0.44–0.56 0.57–0.63 1.00
tileset_wood_damaged 0.99 0.62 0.98
infestation_tile (Materials, real red) 1.00 0.17 1.00
other Materials 0.08–1.00 0.08–0.85 0–0.09

Validation

  • python server/tools/gate.py: all checks passed, including 2 new tests in server/tests/test_floor_tint.py.
  • Live: build_room with tileset_wood_damaged and no floor_color now gives a floor coloured #9e8057; before, it was #ffffff.
  • Not tested: pack textures. Pack art with strong, flat red over most of its area would now be tinted brown.

🤖 Generated with Claude Code

bularzik and others added 3 commits October 26, 2026 04:46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tileset_wood_damaged (and _diamond, _ornate) are red colour masks: the tile
tools tint the red, so placed untinted they rendered white.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thekannen

Copy link
Copy Markdown
Owner

Thanks, Dan. This is a well-scoped fix, and the measurement table makes the thresholds easy to trust. A wood_damaged floor coming out white is clearly wrong.

Small things before it lands:

  • Pack textures. As the PR says, pack art with strong flat red over most of its area would now get the brown tint. A check of a few red-heavy pack floors (brick, carpet, painted tile), with a note on what you found, would settle it.
  • A live case rather than docstring tests. Placing tileset_wood_damaged with no colour and checking that texture_red_mask is true and the colour isn't #ffffff would guard the rule itself.
  • Nit: in _red_mask_from the line continuation has collapsed into tabs in the middle of the expression. It parses, but it reads like a mistake.

How this would land: this repository is the published copy. Development happens in a separate repository, and each release is exported from it here, so merging into main directly would be overwritten by the next export. Changes we accept get ported into the development repository with credit to you, ship in a release, and then this PR is closed with a link to that release.

…nt UAT group

The UAT group places uncoloured floors and checks the rule from both sides:
wood_damaged (a red mask) and a greyscale brick get the default tint, while
infestation and grass materials (real colour) stay white.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bularzik

Copy link
Copy Markdown
Contributor Author

Thanks. All three points are addressed in c8e8cb2.

  • Pack textures: I measured all 25 floor textures in the 9 installed packs, not just a sample (9 Patterns, 7 Materials, 9 Simple Tiles), and the 11 Patterns Colorable as a control. 3 of the 25 change: metal_tiles (A0Ad0iPh), and crystal_pattern and crystal_tiles (Pzv41KLE). Rendered both ways, all three are red colour masks that show a flat white blank untinted, all over in metal_tiles and in the accent bands of the crystal tiles. The other 22 are greyscale, real colour or transparent overlays, and come out as before. No installed pack has a brick, carpet or painted tile with strong flat red; the pack brick (Bricks (2)) is greyscale. Of the 11 Patterns Colorable, which the pack authors mean to be tinted, 10 are read as red masks and the 11th (Roof.png) as greyscale, so all 11 are tinted.
  • Live case: a new floor_tint UAT group checks the rule from both sides. tileset_wood_damaged reports texture_red_mask: true and gets #9e8057, not #ffffff; a greyscale brick is still tinted; alien_infestation_tile and grass_tile_1, which are real colour, stay white. It passes 3/3.
  • Nit: the continuation is now a \ line break, as used elsewhere in the bridge.

@thekannen

Copy link
Copy Markdown
Owner

Thanks, Dan, and for measuring all 25 pack floors. Ported. Our floor_tint group already checked the three core masks and a greyscale tile, so your control (full-colour infestation and grass stay untinted) was added to it. It passes live on macOS. The line continuation was already tidied here.

These commits are authored by you in the development repository, so you will show as a contributor here when the release lands. This PR stays open until then and closes with a link to that release.

@thekannen

Copy link
Copy Markdown
Owner

This shipped in v1.4.1, together with the other four PRs, so I'm closing it here. Your work landed as its own commit authored by you (2189ce3), so you now appear in this repository's contributors. Thanks again, Dan. The live tests on macOS and Windows, including save and reopen, all passed.

@thekannen thekannen closed this Oct 30, 2026
bularzik added a commit to bularzik/battlemap-mcp that referenced this pull request Oct 31, 2026
…toggle

From pull requests thekannen#10-thekannen#14.

- build_room: rooms built side by side share one wall, so a door between
  them opens in a Universal VTT export. Only a wall of the same type (and
  asset, when one is named) is shared; a boundary walled all round gets
  only its floor.
- place_pattern and build_room: Simple Tiles drawn as red colour masks get
  the default floor tint instead of rendering white.
- set_trace_image(position=[x, y]) places a reference image exactly; it is
  saved with the map and safe to repeat.
- set_grid shows or hides the editor grid through View > Grid's checkbox.
- Colourable objects placed without a colour: the note names
  Dungeondraft's default, #6b3834, as a fallback.

Co-authored-by: thekannen <82553859+thekannen@users.noreply.github.com>
bularzik pushed a commit to bularzik/battlemap-mcp that referenced this pull request Oct 31, 2026
…er fix

Most of this release is @bularzik's work, from pull requests thekannen#10-thekannen#14:
thank you, Dan.

- Doors between rooms open in your VTT: a room built beside another
  shares its wall instead of doubling it.
- Simple Tiles drawn as red colour masks come out brown, not white.
- Line up a traced sketch with the grid; hide the editor grid.
- Unpainted colourable objects come with a colour suggestion.
- Moving an old bridge copy out of Program Files now says it needs an
  administrator before touching anything, instead of failing part-way.
- The MCP Bridge panel's note says which settings are yours alone.
- CI uses actions/setup-python 7.1.0 (thekannen#15), and a test no longer breaks
  under pytest 9.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bularzik
bularzik deleted the floor-tint-threshold branch October 31, 2026 17:56
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