mirror of
https://github.com/imarkoff/Marble-shell-theme.git
synced 2025-09-17 16:57:56 -07:00
GNOME dependable installation, structure and style improvements
Split utils in utils.py to a directory Moved ./gnome-shell_css/ to ./gnome-shell/.css/
This commit is contained in:
22
scripts/utils/hex_to_rgba.py
Normal file
22
scripts/utils/hex_to_rgba.py
Normal file
@@ -0,0 +1,22 @@
|
||||
def hex_to_rgba(hex_color):
|
||||
"""
|
||||
Convert hex(a) to rgba
|
||||
:param hex_color: input value
|
||||
"""
|
||||
|
||||
try:
|
||||
if len(hex_color) in range(6, 10):
|
||||
hex_color = hex_color.lstrip('#') + "ff"
|
||||
# if is convertable
|
||||
int(hex_color[:], 16)
|
||||
else:
|
||||
raise ValueError
|
||||
|
||||
except ValueError:
|
||||
raise ValueError(f'Error: Invalid HEX color code: {hex_color}')
|
||||
|
||||
else:
|
||||
return int(hex_color[0:2], 16), \
|
||||
int(hex_color[2:4], 16), \
|
||||
int(hex_color[4:6], 16), \
|
||||
int(hex_color[6:8], 16) / 255
|
Reference in New Issue
Block a user