jongracecox / anybadge

A Python project for generating badges for your projects, with a focus on simplicity and flexibility.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add documentation for using custom color codes

Sieboldianus opened this issue · comments

I love anybadge and use it regularly to create any kind of badges for my projects in gitlab ci (primarily because it is small, and dependencies are installed quickly).

Today I wanted to create a badge with color "blue" - but blue doesn't exist in the default list of colors.

I've used a detour to add "blue" to anybadge, e.g.:

python -c "import anybadge; anybadge.COLORS['blue'] = '#1182C3'; print(anybadge.COLORS.get('blue'))"

However, this seems rather cumbersome and it is also not documented.

Is there an alternative to using custom color codes I perhaps missed?

Ah, got it, I can also pass color codes, not only named colors, e.g.

instead of

anybadge -l version --value="${version_var}" --file=version.svg --color=blue

.. I can do:

anybadge -l version --value="${version_var}" --file=version.svg --color=#1182C3

This wasn't clear from the readme. Anyway, closing this!

Glad you found the solution. I'm actually going to re-open this and use it to:

  • Update the documentation to show how to use custom colors.
  • Add some extra colors to the in-built dictionary.

Extra colors and docs were added in #31