from __future__ import annotations
from dataclasses import dataclass
from functools import wraps
from pathlib import Path
from typing import Any, Callable, Literal, TypeAlias, TypedDict
import requests
import posixpath
import math
__all__ = [
"STYLES",
"Color",
"Name",
"Url",
"Create",
"sheild_io_link",
"badge",
"Badges",
"collect_and_write",
"Parameters",
"PRESETS"
]
LiteralAlias: TypeAlias = type(Literal[""])
PRESETS = {
"made_with_python": """\
\
""",
"made_with_rust": """\
\
"""
}
STYLES: LiteralAlias = Literal[
"plastic", "flat", "flat-square", "for-the-badge", "social"
]
class Parameters(TypedDict, total=False):
style: STYLES
"""Customize the button with the following styles:
- plastic
- flat
- flat-square
- for-the-badge
- social
Example: `?style=flat-square`
"""
label: str
"""Override the default left-hand-side text (URL-Encoding needed for spaces or special characters!)
Example: `?label=healthinesses`
URL-Encoding: https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding
"""
logo: str
"""Insert one of the named logos from (bitcoin, dependabot, gitlab, npm, paypal, serverfault,
stackexchange, superuser, telegram, travis) or simple-icons. Simple-icons are referenced using icon
slugs which can be found on the simple-icons site or in the slugs.md file in the simple-icons repository.
Example: `?logo=appveyor`
Simple-icons: https://simpleicons.org/
slugs.md: https://github.com/simple-icons/simple-icons/blob/develop/slugs.md
"""
logoData: str
"""Insert custom logo image (≥ 14px high). There is a limit on the total size of request headers
we can accept (8192 bytes). From a practical perspective, this means the base64-encoded image text
is limited to somewhere slightly under 8192 bytes depending on the rest of the request header.
Example: `?logo=data:image/png;base64,...`
"""
logoColor: str
"""Set the color of the logo (hex, rgb, rgba, hsl, hsla and css named colors supported).
Supported for named logos and Shields logos but not for custom logos. For multicolor Shields
logos, the corresponding named logo will be used and colored.
Example: `?logoColor=violet`
"""
logoWidth: int
"""Set the horizontal space to give to the logo
Example: `?logoWidth=40`
"""
link: str
"""Specify what clicking on the left/right of a badge should do. Note that this only works
when integrating your badge in an `