Skip to content

Conversation

@demarsdouglas
Copy link
Contributor

Hello! Longtime fan of this project and excited to contribute! :)

This PR looks to address this issue: #582

I've added support for named colors in scc badges. This lets end users use human readable color names instead of only hex values, and preserves backwards compatibility.

WHAT CHANGED:

  • Added a namedColors map that covers the following:
    • shields.io colors (brightgreen, green, yellowgreen, etc..)
    • semantic aliases (success, important, critical, etc..)
    • standard CSS color names (100+ common web colors like white, black, navy, teal, etc..)
  • Added a resolveColor() helper
    • Accepts either a named color or a hex value
    • Returns a normalized hex value
    • Is case-insensitive
    • Returns an empty string for invalid inputs
  • Updated parseBadgeSettings() to use resolveColor() instead of the old hex-only regex validation
  • Added tests :)

With the above, users can now write:

?badge-bg-color=blue&title-bg-color=brightgreen&font-color=white

instead of

?badge-bg-color=007ec6&title-bg-color=44cc11&font-color=fff

Hex codes work exactly as before so this is fully backwards compatible.

Let me know if you have any feedback and I can implement it!

…c alias, and common css color names. add resolve color helper. update parse bade settings to use new helper. add tests for named color resolution
@pr-insights pr-insights bot added M/complexity Normal or medium complexity M/size Normal or medium sized change labels Jan 6, 2026
@boyter
Copy link
Owner

boyter commented Jan 6, 2026

Neat! That looks pretty comprehensive. Going to merge in and ping when its deployed.

@boyter boyter merged commit 4af13ac into boyter:master Jan 6, 2026
3 checks passed
@boyter
Copy link
Owner

boyter commented Jan 6, 2026

Done. Merged and deployed.

Thank you so much @demarsdouglas for this! It was one of those things I have been meaning to add in forever.

@demarsdouglas demarsdouglas deleted the issue-582-simplify-shield-colors branch January 7, 2026 03:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

M/complexity Normal or medium complexity M/size Normal or medium sized change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants