Card Theme System

Shared visual theme for every card surface in the game — level-up reward cards, ship inventory grid, inventory hero card, and weapon popovers. Defined in engine/rendering/card-theme.ts. Provides per-rarity gradients, badge letters, accent colors, and effect tiers, plus a per-family override scheme for weapon cards keyed off damage tag.

Where it’s used

All card surfaces pull from the same theme module:

  • In-game level-up cards (hud.tsdrawRewardCardImpl)
  • Ship inventory grid (CollectibleCard.tsx)
  • Ship inventory hero card (SelectTab.tsx)
  • Weapon popover (reuses drawRewardCard)

One theme module, one source of truth — any palette tweak propagates everywhere.

Two coloring schemes

Cards pick exactly one of two schemes for their identity color:

  1. By rarity — used for artifacts, modifiers, passives, ships. Five-tier jewel-tone palette.
  2. By weapon damage tag — used for weapon cards. Four-tag palette (bullet / energy / fire / bomb).

Per the medical-UI rollout (ADR 20260513-001, tick 78), the identity gradient is no longer a full card background — it’s painted as a header strip around the icon zone at the top of the card. The card panel itself is white (MedicalPalette.panelRaised = ffffff) with a hairline border (#cdd9e8) and a soft cool-blue drop shadow.

Rarity gradient

Each rarity is a distinct hue, saturated enough to read at small grid sizes. Rare is deep sapphire — chosen specifically so it doesn’t collide with the electric-blue energy-weapon pill.

RarityTopBottomAngle
common5a616e12151b170°
uncommon1eb74d (vivid jade)06200e170°
rare0f52ba (deep sapphire)050f2e170°
epic7b1ee0 (royal purple)#140330170°
legendaryf0931a (rich amber)2d1403170°

170° is mostly top-to-bottom with a slight lean right.

Weapon-tag gradient

Kept for any consumer that wants a full card bg colored by damage type. Level-up / reward cards have moved to the rarity gradient; damage-tag pills have their own palette in damage-tag-pill.ts.

TagTopBottom
bullet8a83771c1b18
energy00c8ff (hot electric blue)0a3a78
fired26c1d3b1604
bomb9b20142b0704

Corner badge

Every card has a letter grade in a circle dangling off the upper-left corner:

RarityLetterFill
commonD9ca3af
uncommonC22c55e
rareB2b7bd6
epicAa335ee
legendarySff8000

Badge layout (in CARD_BADGE): radius 14, dangleX 6, dangleY 6 — bigger values + less dangle means more of the badge overlaps the card surface.

Rarity accent

A neon accent color (stronger than the badge fill) used for glow and stroke effects:

RarityAccent
commoncbd5e1
uncommon4ade80
rare3b82f6
epicc084fc
legendaryfbbf24

Rarity effect tier

A 0–4 integer drives which animated effects layer on the card:

RarityTierWhat renders
common0nothing
uncommon0nothing
rare1soft glow
epic2glow + stroke
legendary4glow + stroke + particles + lightning + flash

Tier 3 (glow + stroke + particles, no lightning/flash) is reserved but currently unused — legendary jumps straight to tier 4. Spec intent: nothing for green, little for blue, medium for purple, high for legendary.

Card drop shadow

CARD_SHADOW: offsetY 4, offsetX 0, blur 8, color rgba(20, 30, 50, 0.18). Cool-blue tinted, soft, gentle — replaces the V32 hard black shadow (offset 10, blur 0, 55% alpha). Mirrors the .med-panel box-shadow in medical.css.

Exposed as a CSS string via CARD_SHADOW_CSS for DOM consumers.

Helpers

  • rarityGradientCss(rarity) → CSS linear-gradient string.
  • weaponTagGradientCss(tag) → CSS linear-gradient string.
  • paintCardGradient(ctx, x, y, w, h, stops) → paints the gradient on a canvas rect. Treats angleDeg as a compass bearing (0° = top, clockwise), not the CSS convention (0° = bottom→top).

Key facts

  • Rarity gradient is the identity color carrier — kept as a header strip, not the full card background, since the medical-UI rollout.
  • Card panel is white with a hairline border and a cool-blue drop shadow; the rarity gradient lives at the top of the card.
  • Rare is deep sapphire (#0f52ba) on purpose — separates it from energy-weapon electric blue (#00c8ff).
  • Letter badges run D / C / B / A / S for common → legendary.
  • Effect tier escalates discretely: 0 for common/uncommon, 1 rare, 2 epic, 4 legendary (tier 3 reserved, unused).
  • All four damage tags (bullet / energy / fire / bomb) have a full-card-bg gradient available, but reward cards no longer use it — they use rarity instead.