silverbucket / silverbucket/setlist-roller

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

Open Beginner friendly
#52 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

p3
Dominant language
JavaScript
Stars
1
Forks
0
Avg merge
8h 45m
Merged PRs (30d)
20

Description

`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.)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/lib/utils.js:129-153 and read hexToRgb, hexToRgba, and darkenHex together to compare their validation and channel parsing. Extract the shared parseHex(hex) behavior described in the issue, then verify that the three formatters preserve their existing results without the recursive fallback or repeated logic.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.