Skip to content

Added labelColor, logo, logoColor, new style - social#117

Merged
JellyBellyDev merged 4 commits into
badges:masterfrom
aptyp4uk1337:labelColor-logo-logoColor
May 26, 2026
Merged

Added labelColor, logo, logoColor, new style - social#117
JellyBellyDev merged 4 commits into
badges:masterfrom
aptyp4uk1337:labelColor-logo-logoColor

Conversation

@aptyp4uk1337
Copy link
Copy Markdown
Contributor

I've added the features everyone has been asking for:

  • Added labelColor
  • Added logo (image URL / data:image)
  • Added logoColor
  • Added social style

I've tested it, and everything should work, but I recommend double-checking everything and making any necessary adjustments if something isn't right.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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, and logoColor parsing/storage on Badge and expose them to SVG rendering via shared parameter building.
  • Add a new social SVG template + renderer, and update existing templates to support logoElement and refreshed layout/typography.
  • Refactor renderers by introducing SvgBaseRenderer and enhancing LocalSvgRenderer (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.

Comment thread src/Render/SvgForTheBadgeRenderer.php Outdated
Comment thread src/Render/SvgForTheBadgeRenderer.php
Comment thread src/Render/LocalSvgRenderer.php Outdated
Comment thread src/Render/LocalSvgRenderer.php Outdated
Comment thread src/Calculator/SvgTextSizeCalculator.php Outdated
Comment thread src/Render/SvgSocialRender.php
Comment thread src/Render/LocalSvgRenderer.php Outdated
Comment thread src/Badge.php Outdated
Comment thread src/Badge.php Outdated
Comment thread src/Render/LocalSvgRenderer.php
@garak
Copy link
Copy Markdown
Collaborator

garak commented Apr 28, 2026

Hello @aptyp4uk1337 thank you for your contribution.
Could you please address all the problems raised by the review?
Please also fix the CI failures.

Thank you

@aptyp4uk1337 aptyp4uk1337 marked this pull request as draft April 28, 2026 15:50
@aptyp4uk1337
Copy link
Copy Markdown
Contributor Author

Hello @aptyp4uk1337 thank you for your contribution. Could you please address all the problems raised by the review? Please also fix the CI failures.

Thank you

I had to change tests/Fixtures because they weren't passing. I also used bin/php-cs-fixer to format the code.
I ran tests using bin/phpunit and bin/behat, and there were no errors. I also had to make some changes to .github/workflows/php.yml because Docker kept throwing errors during the warnings. The last test I ran passed without any issues.

@aptyp4uk1337 aptyp4uk1337 marked this pull request as ready for review April 28, 2026 23:36
@antonkomarev
Copy link
Copy Markdown
Collaborator

antonkomarev commented Apr 29, 2026

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.

@aptyp4uk1337
Copy link
Copy Markdown
Contributor Author

aptyp4uk1337 commented Apr 29, 2026

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.

@aptyp4uk1337 aptyp4uk1337 force-pushed the labelColor-logo-logoColor branch from b36f2c7 to 50e3237 Compare April 29, 2026 17:28
@aptyp4uk1337 aptyp4uk1337 marked this pull request as draft May 1, 2026 00:09
@aptyp4uk1337 aptyp4uk1337 marked this pull request as ready for review May 1, 2026 00:09
@garak garak requested a review from JellyBellyDev May 2, 2026 15:24
Copy link
Copy Markdown
Collaborator

@JellyBellyDev JellyBellyDev left a comment

Choose a reason for hiding this comment

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

Fantastic work! Thank you so much!
LGTM

@JellyBellyDev JellyBellyDev merged commit e24e684 into badges:master May 26, 2026
6 checks passed
@JellyBellyDev
Copy link
Copy Markdown
Collaborator

@aptyp4uk1337 only after generating the tag did I realize that we forgot to add documentation on how to use the new features!
Would you like to take care of it?
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants