This is a simple Python based tool to generate badges for your projects, powered by shields.io and tinyurl.
You can use the generated badges in your README.md
or other markdown files to show off the technologies you are using in your project.
Future plans include adding more customization options for the badges and deploying the tool as a web service (see Future Plans).
- Clone this repository to your local machine.
- Make a virtual environment with venv or conda.
- Open a terminal and navigate to the
badges
directory. - Run
pip install -r requirements.txt
to install the required packages. - Place your SVGs in the
icons
directory. - Create a
badge_configs.jsonc
file in thebadges
directory (see format below). - Run
python badge_generator.py
to generate your badges. - The generated badges will be saved to
badges.md
in thebadges
directory.- Note: A
base64
folder will be created containing base64-encoded versions of your SVGs. These are used by the badge generator and can be ignored.
- Note: A
- Copy the generated badge definitions from
badges.md
to yourREADME.md
or other markdown files.
The badge configs are defined in a badge_configs.jsonc
file in the badges
directory. The format is as follows:
{
"<svg_stem_1>": {
"name": "<badge_name>",
"color": "<badge_color>",
"logo_color": "<logo_color>",
"url": "<url>",
"label": "<label>",
"label_color": "<label_color>"
},
"<svg_stem_2>": {
"name": "<badge_name_2>",
"color": "<badge_color_2>",
"logo_color": "<logo_color_2>",
// and so on...
}
Each field impacts the appearance of the badge:
<svg_stem>
: The stem of the SVG file name (without the.svg
extension).- If an SVG is not found, the badge will try to find a SimpleIcons logo that matches the name.
- If a SimpleIcons logo is also not found, the badge will not display a logo.
<badge_name>
: Text to display on the right side of the badge.<label>
: Text to display on the left side of the badge.- If this field is not provided, the left side will still display the logo.
<badge_color>
: The background color of the right side of the badge.<label_color>
: The background color on the left side of the badge.- If this field is not provided, the left side will have the same color as the right side.
<logo_color>
: The color of the logo on the left side of the badge.- The svg will have all colors replaced with this color.
- If this field is not provided, the logo will have its original colors.
<url>
: The URL to link to when the badge is clicked.
- Add more customization options for styling the badges.
- Make a web-based interface for the tool.
- Deploy the tool as a web service.