Skip to content
This repository was archived by the owner on Jan 13, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

setuptools.setup(
name="AthenaColor",
version="4.1.0",
version="4.1.1",
author="Andreas Sas",
author_email="",
description="Package to support full usage of RGB colors in the Console.",
Expand Down
39 changes: 30 additions & 9 deletions src/AthenaColor/Objects/Color/ColorSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def wrapper(self,other:ColorSystem|int|tuple):
# - Actual Color System -
# ----------------------------------------------------------------------------------------------------------------------
class ColorSystem(ABC):
@abstractmethod
def __init__(self, *_):
# no 'ColorSystem' can be created on its own
raise PermissionError
Expand Down Expand Up @@ -111,28 +110,36 @@ def __pow__(self, other: ColorSystem|int|tuple) -> ColorSystem:

@ _ColorConversionInput
def __iadd__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.add(self.export(), other))
self._value_setter(CSD.add(self.export(), other))
return self
@ _ColorConversionInput
def __isub__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.sub(self.export(), other))
self._value_setter(CSD.sub(self.export(), other))
return self
@ _ColorConversionInput
def __imul__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.mul(self.export(), other))
self._value_setter(CSD.mul(self.export(), other))
return self
@ _ColorConversionInput
def __ifloordiv__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.floordiv(self.export(), other))
self._value_setter(CSD.floordiv(self.export(), other))
return self
@ _ColorConversionInput
def __itruediv__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.truediv(self.export(), other))
self._value_setter(CSD.truediv(self.export(), other))
return self
@ _ColorConversionInput
def __itruediv__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.truediv(self.export(), other))
self._value_setter(CSD.truediv(self.export(), other))
return self
@ _ColorConversionInput
def __imod__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.mod(self.export(), other))
self._value_setter(CSD.mod(self.export(), other))
return self
@ _ColorConversionInput
def __ipow__(self, other: ColorSystem|int|tuple) -> ColorSystem:
return self._value_setter(CSD.power(self.export(), other))
self._value_setter(CSD.power(self.export(), other))
return self

# ------------------------------------------------------------------------------------------------------------------
# - Comparison Dunders -
Expand Down Expand Up @@ -164,6 +171,8 @@ def __ge__(self, other: ColorSystem|int|float|tuple) -> bool:
# - RGB -
# ------------------------------------------------------------------------------------------------------------------
class RGB(ColorSystem):
__slots__ = "_r","_g","_b"

"""
Color Object for RGB values.
All r,g,b values are integer values which range between 0 and 255, including.
Expand Down Expand Up @@ -216,6 +225,8 @@ def __repr__(self) -> str:
# ----------------------------------------------------------------------------------------------------------------------
# inherits from rgb as it is just another notation of the rgb format
class HEX(RGB):
__slots__ = "_r","_g","_b"

"""
Color Object for HEX values.
Inherits from RGB as this is just another notation for RGB values.
Expand Down Expand Up @@ -271,6 +282,8 @@ def __pow__(self, other: ColorSystem|int|tuple) -> ColorSystem:
# - RGBA -
# ------------------------------------------------------------------------------------------------------------------
class RGBA(ColorSystem):
__slots__ = "_r","_g","_b", "_a"

"""
Color Object for RGBA values.
All r,g,b,a values are integer values which range between 0 and 255, including.
Expand Down Expand Up @@ -330,6 +343,8 @@ def __repr__(self) -> str:
# ----------------------------------------------------------------------------------------------------------------------
# inherits from rgba as it is just another notation of the rgb format
class HEXA(RGBA):
__slots__ = "_r","_g","_b", "_a"

"""
Color Object for HEXA values.
Inherits from RGBA as this is just another notation for RGBA values.
Expand Down Expand Up @@ -385,6 +400,8 @@ def __pow__(self, other: ColorSystem|int|tuple) -> ColorSystem:
# - HSV -
# ------------------------------------------------------------------------------------------------------------------
class HSV(ColorSystem):
__slots__ = "_h","_s","_v"

"""
Color Object for HSV values.
The h value is a float value which ranges between 0 and 360, including.
Expand Down Expand Up @@ -437,6 +454,8 @@ def __repr__(self) -> str:
# - HSL -
# ------------------------------------------------------------------------------------------------------------------
class HSL(ColorSystem):
__slots__ = "_h","_s","_l"

"""
Color Object for HSL values.
The h value is a float value which ranges between 0 and 360, including.
Expand Down Expand Up @@ -489,6 +508,8 @@ def __repr__(self) -> str:
# - CMYK -
# ----------------------------------------------------------------------------------------------------------------------
class CMYK(ColorSystem):
__slots__ = "_c","_m","_y","_k"

"""
Color Object for CMYK values.
All c,m,y,k values are float values which range between 0 and 1, including
Expand Down
19 changes: 19 additions & 0 deletions src/AthenaColor/Objects/Console/Styling/Inline/RgbControlled.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@
# - Code -
# ----------------------------------------------------------------------------------------------------------------------
class RgbControlled:
__slots__ = (
"_param_code",
"Maroon","DarkRed","Brown","Firebrick","Crimson","Red","Tomato","Coral","IndianRed","LightCoral","DarkSalmon",
"Salmon","LightSalmon","OrangeRed","DarkOrange","Orange","Gold","DarkGoldenRod","GoldenRod","PaleGoldenRod",
"DarkKhaki","Khaki","Olive","Yellow","YellowGreen","DarkOliveGreen","OliveDrab","LawnGreen","Chartreuse",
"GreenYellow","DarkGreen","Green","ForestGreen","Lime","LimeGreen","LightGreen","PaleGreen","DarkSeaGreen",
"MediumSpringGreen","SpringGreen","SeaGreen","MediumAquaMarine","MediumSeaGreen","LightSeaGreen","DarkSlateGray",
"Teal","DarkCyan","Aqua","Cyan","LightCyan","DarkTurquoise","Turquoise","MediumTurquoise","PaleTurquoise",
"AquaMarine","PowderBlue","CadetBlue","SteelBlue","CornFlowerBlue","DeepSkyBlue","DodgerBlue","LightBlue",
"SkyBlue","LightSkyBlue","MidnightBlue","Navy","DarkBlue","MediumBlue","Blue","RoyalBlue","BlueViolet","Indigo",
"DarkSlateBlue","SlateBlue","MediumSlateBlue","MediumPurple","DarkMagenta","DarkViolet","DarkOrchid","MediumOrchid",
"Purple","Thistle","Plum","Violet","Magenta","Orchid","MediumVioletRed","PaleVioletRed","DeepPink","HotPink",
"LightPink","Pink","AntiqueWhite","Beige","Bisque","BlanchedAlmond","Wheat","CornSilk","LemonChiffon",
"LightGoldenRodYellow","LightYellow","SaddleBrown","Sienna","Chocolate","Peru","SandyBrown","BurlyWood","Tan",
"RosyBrown","Moccasin","NavajoWhite","PeachPuff","MistyRose","LavenderBlush","Linen","OldLace","PapayaWhip",
"WeaShell","MintCream","SlateGray","LightSlateGray","LightSteelBlue","Lavender","FloralWhite","AliceBlue",
"GhostWhite","Honeydew","Ivory","Azure","Snow","Black","DimGray","Gray","DarkGray","Silver","LightGray"
,"Gainsboro","WhiteSmoke","White",
)
def __init__(self, param_code:str):
self._param_code = param_code
self.Maroon = ColorSequence(f"{self._param_code}{str(HtmlColorObjects.Maroon)}")
Expand Down