Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.

Commit ed25d43

Browse files
author
DirectiveAthena
committed
Feature: Addition of a Hexadecimal class. Inherits from rgb and is purely a way to input a color with hexadecimal values
1 parent 5e378bf commit ed25d43

File tree

4 files changed

+29
-3
lines changed

4 files changed

+29
-3
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
setuptools.setup(
1616
name="AthenaColor",
17-
version="3.0.4",
17+
version="3.0.5",
1818
author="Andreas Sas",
1919
author_email="",
2020
description="Python Package used to print rgb colors to the console",
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# ----------------------------------------------------------------------------------------------------------------------
2+
# - Package Imports -
3+
# ----------------------------------------------------------------------------------------------------------------------
4+
# General Packages
5+
6+
# Custom Library
7+
8+
# Custom Packages
9+
from .Rgb import rgb
10+
11+
# ----------------------------------------------------------------------------------------------------------------------
12+
# - Code -
13+
# ----------------------------------------------------------------------------------------------------------------------
14+
class hexadecimal(rgb):
15+
# ------------------------------------------------------------------------------------------------------------------
16+
# INIT method
17+
# ------------------------------------------------------------------------------------------------------------------
18+
def __init__(self, hex_value:str):
19+
if isinstance(hex_value, str) and hex_value[0] == "#":
20+
hex_v = hex_value.removeprefix('#')
21+
indexes = (0, 2, 4)
22+
self.r,self.g, self.b = tuple(int(hex_v[i:i+2], 16) for i in indexes)
23+
else:
24+
raise ValueError("no correct str was given on creation")
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
from .HtmlColors import HtmlColors
2-
from .Rgb import rgb
2+
from .Rgb import rgb
3+
from .Hexadecimal import hexadecimal

src/AthenaColor/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def set_esc(self, escape_code:str=None):
4646
)
4747
from AthenaColor.Objects import (
4848
rgb,
49-
HtmlColors
49+
HtmlColors,
50+
hexadecimal
5051
)
5152

5253
class Style:

0 commit comments

Comments
 (0)