Skip to content

Bloat: hex helpers in utils.js share validate→parse pattern #52

@silverbucket

Description

@silverbucket

`src/lib/utils.js:129-153` — `hexToRgb`, `hexToRgba`, `darkenHex` each repeat the regex validation and per-channel parse. The recursive fallback (`return hexToRgb(DEFAULT_DIE_COLOR)`) makes them harder to read than they need to be.

Fix: extract `parseHex(hex) → [r,g,b] | null`, then write all three formatters as one-liners. Removes ~15 lines and the recursion.

(From comprehensive review, finding B2.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions