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

Commit e5f4fbc

Browse files
authored
Merge pull request #1 from ClasherKasten/feature/add-linux-compatibility
'color' command only gets called on windows
2 parents 757a1a4 + 8f3c830 commit e5f4fbc

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/AthenaColor/__init__.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# General Packages
55
from __future__ import annotations
66
import os
7+
import sys
78

89
# Custom Library
910

@@ -12,13 +13,20 @@
1213
# ----------------------------------------------------------------------------------------------------------------------
1314
# - INIT class -
1415
# ----------------------------------------------------------------------------------------------------------------------
15-
class init:
16+
class Init:
1617
esc_hex = "\x1b"
1718
esc_octal = "\033"
1819
esc_uni = "\u001b"
1920

2021
esc = esc_hex
2122

23+
def __init__(self, escape_code:str=None):
24+
self.set_esc(escape_code)
25+
26+
# prep the console for colors
27+
if sys.platform == 'win32':
28+
os.system("color")
29+
2230
@classmethod
2331
def set_esc(cls, escape_code:str=None):
2432
# define escape codes
@@ -28,7 +36,7 @@ def set_esc(cls, escape_code:str=None):
2836
cls.esc = escape_code
2937
else:
3038
raise ValueError("escape_code not defined correctly")
31-
39+
init = Init()
3240

3341
# ----------------------------------------------------------------------------------------------------------------------
3442
# - AthenaColor Imports -
@@ -90,4 +98,4 @@ class Unverfified:
9098
Fraktur,
9199
PropSpacing,
92100
NoPropSpacing,
93-
)
101+
)

0 commit comments

Comments
 (0)