mirror of
https://github.com/LucasVbr/LucasVbr.git
synced 2026-05-13 17:11:52 +00:00
init branch
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
__pycache__/*
|
||||
__pycache__/**/*
|
||||
@@ -1,54 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from simpleicons.all import icons
|
||||
from urllib.parse import urlencode
|
||||
from colour import Color
|
||||
|
||||
"""
|
||||
04/06/2022
|
||||
"""
|
||||
|
||||
__file__ = 'Badge.py'
|
||||
__author__ = 'Lucas Vbr'
|
||||
__version__ = '0.1'
|
||||
|
||||
|
||||
class Badge:
|
||||
def __init__(self, badgeName: str):
|
||||
self.name = badgeName
|
||||
self.url = ""
|
||||
self.color = 0
|
||||
|
||||
self.buildUrl()
|
||||
|
||||
def get_color(self):
|
||||
return self.color
|
||||
|
||||
def buildUrl(self):
|
||||
BASE_URL = "https://img.shields.io/static/v1"
|
||||
LOGO_COLOR = "white"
|
||||
|
||||
icon = icons.get(self.name)
|
||||
|
||||
color_hue = Color(f'#{icon.hex}').get_hue()
|
||||
color_hsl = (color_hue, 0.75, 0.5)
|
||||
color = Color()
|
||||
color.set_hsl(color_hsl)
|
||||
|
||||
try:
|
||||
params = {
|
||||
"label": "",
|
||||
"message": icon.title,
|
||||
"color": color,
|
||||
"logo": icon.slug,
|
||||
"logoColor": LOGO_COLOR
|
||||
}
|
||||
urlParams = urlencode(params)
|
||||
self.url = f"{BASE_URL}?{urlParams}"
|
||||
self.color = color_hue
|
||||
except Exception:
|
||||
pass # Let default values
|
||||
|
||||
|
||||
def getBadgeColor(badge: Badge) -> float:
|
||||
return badge.color
|
||||
@@ -1,39 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
"""
|
||||
04/06/2022
|
||||
"""
|
||||
|
||||
import json
|
||||
|
||||
__file__ = 'FileUtils.py'
|
||||
__author__ = 'Lucas Vbr'
|
||||
__version__ = '0.1'
|
||||
|
||||
DEFAULT_FILE_ENCODING = "utf8"
|
||||
|
||||
|
||||
def getJsonData(filePath: str) -> str:
|
||||
"""
|
||||
Take data from JSON File
|
||||
:param filePath: Path of the file to read
|
||||
:return: The content of the JSON file
|
||||
"""
|
||||
with open(filePath, encoding=DEFAULT_FILE_ENCODING) as file:
|
||||
data = json.load(file)
|
||||
return data
|
||||
|
||||
|
||||
def setJsonData(filePath: str, content) -> None:
|
||||
setFileData(filePath, json.dumps(content, indent=2))
|
||||
|
||||
|
||||
def setFileData(filePath: str, content: str) -> None:
|
||||
"""
|
||||
Create a new File or replace it content if already exist
|
||||
:param filePath: Path of the file to fill
|
||||
:param content: Content to place in the file
|
||||
:return: None
|
||||
"""
|
||||
with open(filePath, "w", encoding=DEFAULT_FILE_ENCODING) as file:
|
||||
file.write(content)
|
||||
@@ -1,69 +0,0 @@
|
||||
EMOJIS = {
|
||||
"p1j": ":sunny:",
|
||||
"p1n": ":full_moon:",
|
||||
"p2j": ":partly_sunny:",
|
||||
"p2n": ":cloud:",
|
||||
"p3j": ":cloud:",
|
||||
"p3n": ":cloud:",
|
||||
"p4j": ":fog:",
|
||||
"p4n": ":fog:",
|
||||
"p5j": ":fog:",
|
||||
"p5n": ":fog:",
|
||||
"p6j": ":fog:",
|
||||
"p6n": ":fog:",
|
||||
"p7j": ":fog:",
|
||||
"p7n": ":fog:",
|
||||
"p8j": ":fog:",
|
||||
"p8n": ":fog:",
|
||||
"p9j": ":cloud_with_rain:",
|
||||
"p9n": ":cloud_with_rain:",
|
||||
"p10j": ":cloud_with_rain:",
|
||||
"p10n": ":cloud_with_rain:",
|
||||
"p11j": ":cloud_with_rain:",
|
||||
"p11n": ":cloud_with_rain:",
|
||||
"p12j": ":cloud_with_rain:",
|
||||
"p12n": ":cloud_with_rain:",
|
||||
"p13j": ":cloud_with_rain:",
|
||||
"p13n": ":cloud_with_rain:",
|
||||
"p14j": ":cloud_with_rain:",
|
||||
"p14n": ":cloud_with_rain:",
|
||||
"p15j": ":cloud_with_rain:",
|
||||
"p15n": ":cloud_with_rain:",
|
||||
"p16j": ":cloud_with_lightning:",
|
||||
"p16n": ":cloud_with_lightning:",
|
||||
"p17j": ":cloud_with_snow:",
|
||||
"p17n": ":cloud_with_snow:",
|
||||
"p18j": ":cloud_with_snow:",
|
||||
"p18n": ":cloud_with_snow:",
|
||||
"p19j": ":cloud_with_snow:",
|
||||
"p19n": ":cloud_with_snow:",
|
||||
"p20j": ":cloud_with_snow:",
|
||||
"p20n": ":cloud_with_snow:",
|
||||
"p21j": ":cloud_with_snow:",
|
||||
"p21n": ":cloud_with_snow:",
|
||||
"p22j": ":cloud_with_snow:",
|
||||
"p22n": ":cloud_with_snow:",
|
||||
"p23j": ":cloud_with_snow:",
|
||||
"p23n": ":cloud_with_snow:",
|
||||
"p24j": ":cloud_with_lightning:",
|
||||
"p24n": ":cloud_with_lightning:",
|
||||
"p25j": ":cloud_with_lightning:",
|
||||
"p25n": ":cloud_with_lightning:",
|
||||
"p26j": ":cloud_with_lightning:",
|
||||
"p26n": ":cloud_with_lightning:",
|
||||
"p27j": ":cloud_with_lightning:",
|
||||
"p27n": ":cloud_with_lightning:",
|
||||
"p28j": ":cloud_with_lightning:",
|
||||
"p28n": ":cloud_with_lightning:",
|
||||
"p29j": ":cloud_with_lightning:",
|
||||
"p29n": ":cloud_with_lightning:",
|
||||
"p30j": ":cloud_with_lightning:",
|
||||
"p30n": ":cloud_with_lightning:",
|
||||
"p31j": ":star:",
|
||||
"p31n": ":star:",
|
||||
"p32j": ":tornado:",
|
||||
"p32n": ":tornado:",
|
||||
"p33j": ":tornado:",
|
||||
"p33n": ":tornado:",
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user