Repository navigation
feat: add hair colour and hairstyle options - #11
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
HarrisJDCampbell
left a comment
There was a problem hiding this comment.
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:
- 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 oldHAIRconstant. It's now drawn withhairColor, so a blonde player gets a blonde eye. Could you keep the eye a fixed dark colour (#2b1d14) whatever the hair is? - One name for the option.
render()accepts bothhairStyleand'hair-style'. Let's keep onlyhairStyleinrender(). The CLI can map--hair-styleto it, and the action input stayshair_style. - Merge in
main. The newest-first, streak and jersey PRs just landed and touch the samerender()signature and test imports, so this one conflicts now.
Happy to help with any of it. Just shout.
|
Thanks for the review @HarrisJDCampbell! All three points have been addressed:
|
|
Thanks for sticking with this one! The eye fix and the single |
Resolves #8
Summary of Changes
Adds customizable
hair(hex colour) andhair_styleoptions so users can customize the player sprite for their README:hair: accepts any 3- or 6-digit hex colour (e.g.#2b1d14default,#e6be8ablonde,#b55239red), validated withparseColor(hair, 'hair').hair_style/hairStyle: accepts'short','long', or'headband'(case-insensitive), validated withparseHairStyle().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'strimaccent colour, with hair volume on top.--hairand--hair-styleinbin/hoops.mjs, as well as inputs inaction.ymlandsrc/index.mjs.test/render.test.mjsverifying input validation, case-insensitivity, and SVG output for all styles.README.md.Testing
npm test— all 11 tests pass in ~400ms via nativenode --test.npm run demo— verified clean SVG output in both light and dark themes.