Skip to content

feat: add hair colour and hairstyle options - #11

Merged
HarrisJDCampbell merged 4 commits into
HarrisJDCampbell:mainfrom
DrashtiC07:feat-hair-options
Oct 30, 2026
Merged

HarrisJDCampbell merged 4 commits into
HarrisJDCampbell:mainfrom
DrashtiC07:feat-hair-options

Conversation

@DrashtiC07

@DrashtiC07 DrashtiC07 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #8

Summary of Changes

Adds customizable hair (hex colour) and hair_style options so users can customize the player sprite for their README:

  • hair: accepts any 3- or 6-digit hex colour (e.g. #2b1d14 default, #e6be8a blonde, #b55239 red), validated with parseColor(hair, 'hair').
  • hair_style / hairStyle: accepts 'short', 'long', or 'headband' (case-insensitive), validated with parseHairStyle().
    • short (default): preserves the original pixel-art sprite exactly (100% backwards-compatible).
    • long: adds a tapered athletic ponytail plume down the back of the player.
    • headband: renders a headband across the forehead in the jersey's trim accent colour, with hair volume on top.
  • CLI & Action: wired into --hair and --hair-style in bin/hoops.mjs, as well as inputs in action.yml and src/index.mjs.
  • Tests: added test coverage in test/render.test.mjs verifying input validation, case-insensitivity, and SVG output for all styles.
  • Docs: updated the Options table in README.md.

Testing

  • Ran npm test — all 11 tests pass in ~400ms via native node --test.
  • Ran npm run demo — verified clean SVG output in both light and dark themes.

@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e47f8e22-a56e-4c8d-9311-3a66e49bb595
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@HarrisJDCampbell HarrisJDCampbell left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DrashtiC07, this is a fun one, and all three styles look good. I rendered short, long and headband to check. Three small things before it goes in:

  1. The eye takes the hair colour. The 1px pixel at (1, -24) on the face is the player's eye, and it was drawn with the old HAIR constant. It's now drawn with hairColor, so a blonde player gets a blonde eye. Could you keep the eye a fixed dark colour (#2b1d14) whatever the hair is?
  2. One name for the option. render() accepts both hairStyle and 'hair-style'. Let's keep only hairStyle in render(). The CLI can map --hair-style to it, and the action input stays hair_style.
  3. Merge in main. The newest-first, streak and jersey PRs just landed and touch the same render() signature and test imports, so this one conflicts now.

Happy to help with any of it. Just shout.

@DrashtiC07

Copy link
Copy Markdown
Contributor Author

Thanks for the review @HarrisJDCampbell! All three points have been addressed:

  1. Fixed eye colour: Kept the eye pixel at (1, -24) a fixed dark #2b1d14 constant regardless of hair color.
  2. Consistent option naming: Standardized on hairStyle in render(). CLI maps --hair-style and the Action passes hair_style directly to it.
  3. Upstream merge: Merged main and resolved all merge conflicts. All 19 tests are passing cleanly.

@HarrisJDCampbell

Copy link
Copy Markdown
Owner

Thanks for sticking with this one! The eye fix and the single hairStyle name are exactly right, and the ponytail on long reads really well at that size. I pushed one small commit so it could land today: with headband the band sat on the eye row and covered the eye, so I moved it up a row and added a test that the eye is still drawn. Also put --order and --footer back in the CLI usage comment. Merging 🏀

@HarrisJDCampbell
HarrisJDCampbell merged commit b1888a0 into HarrisJDCampbell:main Oct 30, 2026
5 checks 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.

Hair colour and style options

2 participants