Skip to content

color-by-sign: revert to upward V; sign → color - #11

Merged
jackhenderson12 merged 2 commits into
mainfrom
color-by-sign
May 8, 2026
Merged

color-by-sign: revert to upward V; sign → color#11
jackhenderson12 merged 2 commits into
mainfrom
color-by-sign

Conversation

@jackhenderson12

Copy link
Copy Markdown
Contributor

Summary

  • Reverts the round-12 diamond to a single upward V — water always fills with gravity from the apex up. Sign of the vote becomes water color (green for positive, red for negative) rather than a second V below the midline.
  • Pool retunes to a neutral gray-blue gradient (--lqv-pool--lqv-pool-dark) so the budget reservoir doesn't pre-empt either side.
  • New src/lib/voteColor.ts helper centralizes the sign→color mapping; Funnel and PourStream consume it. ThemeOverrides gains votePositive(/-Dark), voteNegative(/-Dark), and poolDark so embeds can rebrand.
  • Ruler reverts to unsigned 0–10 magnitude. ARIA still reports signed aria-valuenow; the under-funnel readout still uses U+2212 for negatives.
  • Explainer gains a 4th step ("Or vote against. Press the − button. The water turns red.") with a side-by-side green/red glyph. Step 1's funnel glyph recolored to positive green so the explainer matches the tool.

The signed-vote maths = sign(v) × v², monotonic cross-zero accumulation, signed clamping, sign-preserving rounding — is the round-12 implementation, unchanged. Only rendering and color wiring change.

Test plan

  • All 37 existing tests pass (npm test) — no new test cases needed; pure rendering/color refactor doesn't cross the math/reducer boundary.
  • npm run lint clean.
  • npm run typecheck clean.
  • npm run build:all succeeds across SPA, library, and Web Component targets.
  • Visually verified in npm run dev:
    • Empty state: pool 100/100 neutral; all funnels at 0 with no water.
    • Positive vote: green fill (rgb(52, 211, 153)) up the upward V.
    • Negative vote: red fill (rgb(248, 113, 113)) up the same upward V.
    • Mixed-sign grid: green and red funnels coexist; conservation holds.
    • Cross-zero hold: green drains → empty (no water at v=0) → red refills, one continuous gesture.
  • Pour stream's funnel-side end tracks the funnel's sign color; pool-side stays neutral; stream suppressed at exactly v = 0 so there's no flash of the wrong color at the transition.

See docs/round-13/README.md for verified-DOM walkthroughs of each state.

Do not merge — for review only.

🤖 Generated with Claude Code

Jack Henderson and others added 2 commits May 8, 2026 15:52
Round 12's diamond had two regressions: at rest the page filled with
hourglass shapes that don't read as ballot items, and the lower V's
gravity model required water to fill a downward-pointing apex. Round 13
restores the single upward V from rounds 4–11 and pulls all sign
communication into water color.

- Funnel: water height = |votes| × scale; fill uses voteColor(sign(v));
  surface stroke uses voteColorDark(sign(v)); walls stay neutral.
  Ruler reverts to unsigned 0–10 magnitude. ARIA still reports signed
  votes; readout still uses U+2212 for negatives.
- CreditPool: neutral gray-blue gradient (--lqv-pool → --lqv-pool-dark)
  so the pool doesn't pre-emptively bias toward either side.
- PourStream: takes voteSign prop; funnel-side gradient stop tracks
  voteColor(sign), pool-side stays neutral. Suppressed at exactly v=0.
- voteColor() helper centralizes sign→color mapping. zero defaults to
  positive but never visibly resolves (Funnel skips rendering at v=0).
- ThemeOverrides gains votePositive(/-Dark), voteNegative(/-Dark), and
  poolDark for embeds that rebrand sign colors.
- Explainer gains a 4th step ("Or vote against. Press the − button.
  The water turns red.") with a side-by-side green/red glyph; step 1's
  funnel glyph recolored to positive green so explainer matches tool.

Math, reducer, and active-pour state machine unchanged. All 37 tests
still pass; lint, typecheck, and all 3 build targets clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Verified-DOM walkthrough of empty/positive/negative/mixed/cross-zero
states with computed fill colors, plus notes on the voteColor helper,
theme overrides, and the new explainer step.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jackhenderson12
jackhenderson12 merged commit 63eda8b into main May 8, 2026
1 check 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