Skip to content

Commit

Permalink
V1.3.4: Added Colorama module to deal with colors for unsported consoles
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjameschamp committed Feb 9, 2023
1 parent 3df683a commit edf01f6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion iryn360.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from util import functions, colargulog

VERSION = '1.3.3'
VERSION = '1.3.4'

DEBUG = False

Expand Down
14 changes: 13 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "iracing-yn360"
version = "1.3.3"
version = "1.3.4"
description = "Simple application that connects the iRacing flags to a YN360 RGB Light"
authors = ["Chris Champeau <[email protected]>"]
license = "MIT"
Expand All @@ -17,6 +17,7 @@ semantic-version = "^2.10.0"
packaging = "^23.0"
requests = "^2.28.2"
pyinstaller = "^5.7.0"
colorama = "^0.4.6"


[build-system]
Expand Down
22 changes: 12 additions & 10 deletions util/colargulog.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import colorama
import logging
import logging.handlers
import re

class ColorCodes:
white = "\x1b[38;21m"
grey = "\x1b[2m"
green = "\x1b[1;32m"
yellow = "\x1b[33;21m"
red = "\x1b[31;21m"
bold_red = "\x1b[31;1m"
blue = "\x1b[1;34m"
light_blue = "\x1b[1;36m"
purple = "\x1b[1;35m"
reset = "\x1b[0m"
white = colorama.Fore.WHITE + colorama.Style.NORMAL
grey = colorama.Fore.WHITE + colorama.Style.DIM
green = colorama.Fore.GREEN + colorama.Style.BRIGHT
yellow = colorama.Fore.YELLOW + colorama.Style.NORMAL
red = colorama.Fore.RED + colorama.Style.NORMAL
bold_red = colorama.Fore.RED + colorama.Style.BRIGHT
blue = colorama.Fore.BLUE + colorama.Style.NORMAL
light_blue = colorama.Fore.LIGHTBLUE_EX + colorama.Style.NORMAL
purple = colorama.Fore.MAGENTA + colorama.Style.NORMAL
reset = colorama.Fore.RESET + colorama.Style.RESET_ALL


class ColorizedArgsFormatter(logging.Formatter):
Expand All @@ -35,6 +36,7 @@ class ColorizedArgsFormatter(logging.Formatter):

def __init__(self, fmt: str, datefmt=None):
super().__init__()
colorama.init()
self.level_to_formatter = {}

def add_color_format(level: int):
Expand Down

0 comments on commit edf01f6

Please sign in to comment.