Added labelColor, logo, logoColor, new style - social#117
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the badge rendering system to support additional customization options (labelColor + logo/logoColor) and introduces a new “social” badge style, along with a renderer refactor to share common SVG rendering behavior.
Changes:
- Add
labelColor,logo, andlogoColorparsing/storage onBadgeand expose them to SVG rendering via shared parameter building. - Add a new
socialSVG template + renderer, and update existing templates to supportlogoElementand refreshed layout/typography. - Refactor renderers by introducing
SvgBaseRendererand enhancingLocalSvgRenderer(logo element generation, parameter changes, and SVG output normalization).
Reviewed changes
Copilot reviewed 11 out of 16 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/UI/Command.php | Registers the new social renderer in the CLI command’s Poser. |
| src/Resources/templates/social.svg | Adds a new SVG template for the “social” style. |
| src/Resources/templates/plastic.svg | Updates plastic template to new layout + optional logoElement. |
| src/Resources/templates/for-the-badge.svg | Updates for-the-badge template to uppercase vars + optional logoElement. |
| src/Resources/templates/flat.svg | Updates flat template to new layout + optional logoElement. |
| src/Resources/templates/flat-square.svg | Updates flat-square template to new layout + optional logoElement. |
| src/Render/SvgSocialRender.php | Introduces renderer-specific geometry for “social” style (pill gap + text shift). |
| src/Render/SvgPlasticRender.php | Refactors to inherit common template-name behavior via SvgBaseRenderer. |
| src/Render/SvgForTheBadgeRenderer.php | Refactors sizing/centering logic and logo Y positioning for 28px height. |
| src/Render/SvgFlatSquareRender.php | Refactors to inherit common template-name behavior via SvgBaseRenderer. |
| src/Render/SvgFlatRender.php | Refactors to inherit common template-name behavior via SvgBaseRenderer. |
| src/Render/SvgBaseRenderer.php | Adds shared “template name = style” base implementation. |
| src/Render/LocalSvgRenderer.php | Adds logo support + new width/position parameter calculations + output normalization. |
| src/Poser.php | Makes getRenderFor() public. |
| src/Calculator/SvgTextSizeCalculator.php | Adds dependency checks and better error reporting. |
| src/Badge.php | Adds labelColor/logo/logoColor support and accepts 3-digit hex colors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hello @aptyp4uk1337 thank you for your contribution. Thank you |
I had to change tests/Fixtures because they weren't passing. I also used bin/php-cs-fixer to format the code. |
|
If we are changing fixtures, it means that we are breaking BC. And do we really need to change CI file? This PR is pretty complex and huge. Maybe it will be better to split it for a separate feature branches, that solves only one thing at a time. I mean at least does not mix new social badge to this PR. |
The fixtures doesn't seem like any test checks the social media icon at all—there shouldn't be any issues with it. I had issues with the fixtures because the SVG structure didn't match the existing one. There were issues with the code structure, which were fixed using the bin/php-cs-fixer command. The other issues were that I couldn’t run GitHub Actions locally via Docker for the check; there were some problems with packages and paths, so I had to make changes to .github/workflows/php.yml as well, after which all tests passed without errors. |
b36f2c7 to
50e3237
Compare
JellyBellyDev
left a comment
There was a problem hiding this comment.
Fantastic work! Thank you so much!
LGTM
|
@aptyp4uk1337 only after generating the tag did I realize that we forgot to add documentation on how to use the new features! |
I've added the features everyone has been asking for:
I've tested it, and everything should work, but I recommend double-checking everything and making any necessary adjustments if something isn't right.