Skip to content

🏷️ Tool for generating markdown friendly badges

Notifications You must be signed in to change notification settings

martivj/BadgeGenerator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BadgeGenerator

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).

python json

Usage

Step-by-Step Guide

  1. Clone this repository to your local machine.
  2. Make a virtual environment with venv or conda.
  3. Open a terminal and navigate to the badges directory.
  4. Run pip install -r requirements.txt to install the required packages.
  5. Place your SVGs in the icons directory.
  6. Create a badge_configs.jsonc file in the badges directory (see format below).
  7. Run python badge_generator.py to generate your badges.
  8. The generated badges will be saved to badges.md in the badges 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.
  9. Copy the generated badge definitions from badges.md to your README.md or other markdown files.

Badge Configs

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.

Future Plans

  • Add more customization options for styling the badges.
  • Make a web-based interface for the tool.
  • Deploy the tool as a web service.

About

🏷️ Tool for generating markdown friendly badges

Topics

Resources

Stars

Watchers

Forks

Languages