Created
August 11, 2017 20:26
-
-
Save gabrielkrell/b5071f2d2a06cf320de0788bb84eb064 to your computer and use it in GitHub Desktop.
Python snippet that assembles a shields.io badge with a custom SVG icon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
baseurl = ("https://img.shields.io/badge/{subj}-{status}-{color}.svg" | |
"?style={style}" | |
"&link={link}&link={link}" # left/+right links | |
"&logo={logo}") | |
opts = {...} | |
... | |
curr_dir = os.path.dirname(os.path.abspath(__file__)) | |
icon_path = os.path.join(curr_dir, 'static', 'fonts', 'icons', 'style-guide-icons-indiv', 'mail.svg') | |
with open(name=icon_path) as icon: | |
s = "data:image/svg+xml;base64," + base64.b64encode(icon.read()) | |
opts['logo'] = urllib.quote(s) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment