feat(engine): switch card fronts to 4-colour deck

Hearts pink (`#fb9fb1`), Diamonds gold (`#ddb26f`), Clubs lime
(`#acc267`), Spades gray (`#d0d0d0`) — each suit picks up its
own base16-eighties accent so a player scanning the table can
distinguish the suit by hue alone (faster recognition than the
2-colour traditional red/black scheme; common in poker decks).
All four colours already exist in the palette as semantic
state-token accents, so this is a pure remapping at the suit-
glyph site, not a palette extension.

The outlined-glyph differentiation (♦ ♣ outlined, ♥ ♠ filled)
is preserved on top of the colour split — it stays the always-
on colour-blind fallback per `design-system.md` §Accessibility,
and matters more than ever now that CBM hearts (lime) and
default clubs (lime) share a hue.

### Changes

- `card_face_svg.rs`: split `SUIT_RED` / `SUIT_DARK` into four
  per-suit constants (`SUIT_HEART` / `SUIT_DIAMOND` / `SUIT_CLUB`
  / `SUIT_SPADE`). `suit_paint()` returns each suit's own
  colour. Card border picks up the suit colour automatically
  via the existing `(colour, paint)` destructure.
- `card_plugin.rs`: new `DIAMOND_SUIT_COLOUR` + `CLUB_SUIT_COLOUR`
  constants; `text_colour()` rewritten as a per-suit match (was
  red/black bifurcation). Both rendering paths (PNG production +
  constant fallback under MinimalPlugins) stay in lockstep.
- CBM behaviour clarified: only hearts swap to lime now;
  diamonds + clubs + spades are already hue-distinct from
  the heart pink and stay unchanged. Under CBM the heart
  (lime) and club (lime) share a hue but stay distinguishable
  via the always-on filled-vs-outlined glyph differentiation.
- HC behaviour: only hearts (→ HC red) and spades (→ HC white)
  have defined boosts. Diamonds (gold) and clubs (lime) are
  already mid-luminance accents and stay at their default.
  New test `text_colour_diamonds_and_clubs_are_immune_to_accessibility_flags`
  pins all four flag combinations as no-ops for the gold +
  lime suits.
- `design-system.md` §Suit Colors retitled "Four-color deck"
  with the 4-colour table; CBM section text updated to
  describe the hearts-only swap and the hearts/clubs hue
  collision under CBM.
- `card_face_svg_pin.rs` rebaselined: 26 hashes drift
  (13 clubs + 13 diamonds — the two suits whose colours
  changed). Hearts, spades, and the 5 backs all keep their
  prior hashes. Surgical scope, exactly what the pin test
  was designed to surface.

### Tests

1191 passing / 0 failing — net 0 from the prior baseline:
two old 2-colour tests removed
(`text_colour_is_red_for_hearts_and_diamonds`,
`text_colour_is_black_for_clubs_and_spades`), one consolidated
4-colour test added
(`text_colour_4_colour_deck_assigns_each_suit_its_own_hue`)
plus a pairwise-distinct invariant guard, and one new test
covering the gold/lime suits' immunity to CBM/HC flags. Six
existing CBM/HC tests rewritten to use only the suits each flag
actually affects under the new scheme (hearts for CBM, hearts +
spades for HC).

Workspace clippy clean.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
funman300
2026-05-08 12:00:55 -07:00
parent 31139ae455
commit 62b61cc786
56 changed files with 306 additions and 225 deletions
+26 -26
View File
@@ -24,32 +24,32 @@ use solitaire_engine::assets::card_face_svg::{
use solitaire_engine::assets::rasterize_svg;
const EXPECTED: &[(&str, u64)] = &[
("face_AC", 0xdac8c6f869cea53c),
("face_2C", 0x8976454d1919bfdb),
("face_3C", 0x0eda320371ca2d3f),
("face_4C", 0x2e921081296553c9),
("face_5C", 0xdb574a322d615af0),
("face_6C", 0xad93daa160b5e7fa),
("face_7C", 0xa3cdae097cb23271),
("face_8C", 0x7b652bc9f0a5940b),
("face_9C", 0xb5b274c80f319b85),
("face_10C", 0x2ed8324f84c443cd),
("face_JC", 0x3d9bc380e83d7611),
("face_QC", 0xacad01ad4053a396),
("face_KC", 0xba575aa772fc2e3e),
("face_AD", 0xe1049b5a7d2c110c),
("face_2D", 0x58f2a7e60a5cfff9),
("face_3D", 0x89aeece03e7afe0b),
("face_4D", 0xb97dd2633958d6ba),
("face_5D", 0x32b57300e16c5b30),
("face_6D", 0xd617e851d97f4a7d),
("face_7D", 0xdd2da9b2457bfded),
("face_8D", 0xfe00cf683015f30b),
("face_9D", 0x7188b0fade3d086a),
("face_10D", 0x53d0db517868e1f7),
("face_JD", 0xeb2c6a0192146258),
("face_QD", 0x36edafbbc3d34f0a),
("face_KD", 0x1bbfa8b1176ee3ac),
("face_AC", 0x287e3293f95990a5),
("face_2C", 0x01c66d8e461fb0c4),
("face_3C", 0xfdae6be53af8b7c8),
("face_4C", 0x4b2a7aef966c6cc2),
("face_5C", 0xa4ca0ce3759b5cc9),
("face_6C", 0xe1a730d1ce810314),
("face_7C", 0x9c8de5c7d014eca3),
("face_8C", 0x39e09f90c957b192),
("face_9C", 0xd6627707fb2d5079),
("face_10C", 0xbe8411c60411195c),
("face_JC", 0x7c33abf5619477ac),
("face_QC", 0xe75657d63c99a892),
("face_KC", 0xf4a445b771026496),
("face_AD", 0xad8820c694c464d7),
("face_2D", 0xef771dbb39ae4f5a),
("face_3D", 0xe955ec9a96e1256a),
("face_4D", 0x6bb5979ef6004957),
("face_5D", 0x55715fd2353b2126),
("face_6D", 0x87fbd6efce1b1f9f),
("face_7D", 0xabb2d52d363e93ab),
("face_8D", 0xde78161ee9093b05),
("face_9D", 0x1475987ba1e66036),
("face_10D", 0x3a52d7fda7158aeb),
("face_JD", 0xc9078d8a7b2e6372),
("face_QD", 0x84c9011b916fdbe8),
("face_KD", 0xbcd20dbb6b1c8cdf),
("face_AH", 0x2c8e05964b5e3a5f),
("face_2H", 0xb44e68b79bb3842e),
("face_3H", 0x15226ed29769e1c4),