Skip to content

Commit

Permalink
3.8.10
Browse files Browse the repository at this point in the history
  • Loading branch information
dkundih committed Aug 7, 2022
1 parent 84ec5bd commit 669ec96
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 24 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,4 +512,8 @@ CHANGELOG

3.8.9 (07/08/2022)
- paint_text added to toolkit.
- now also inits colorama colors before other packages to avoid conflicts.
- now also inits colorama colors before other packages to avoid conflicts.

3.8.10 (07/08/2022)
- changes to coloring policies
- alligned paint_text to duality._paint_text changes.
4 changes: 3 additions & 1 deletion vandal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
file_handler(file) - handles the file extension upon import.
paint_text(text, color, print_trigger = True) - paints the text with a desired color ('r', 'g', 'b', 'k', 'c', 'm', 'y').
paint_text(text, color, print_trigger) - paints the text with a desired color ('fr', 'fg', 'fb', 'fk', 'fc', 'fm', 'fy', 'br', 'bg', 'bb', 'bk', 'bc', 'bm', 'by').
EXAMPLE (MODULE FUNCTIONS)
--------------------------
Expand Down Expand Up @@ -91,6 +91,8 @@
# colorama imports.
from colorama import (
Fore,
Back,
Style,
init,
)

Expand Down
2 changes: 2 additions & 0 deletions vandal/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# coloring.
from colorama import (
Fore,
Back,
Style,
init,
)

Expand Down
10 changes: 10 additions & 0 deletions vandal/hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
from vandal.hub import toolkit
from vandal.hub import example

# coloring.
from colorama import (
Fore,
Back,
Style,
init,
)

init()

from vandal.hub.toolkit import (
random_value,
random_pool,
Expand Down
64 changes: 45 additions & 19 deletions vandal/hub/toolkit.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# coloring.
from colorama import (
Fore,
init,
Fore,
Back,
Style,
init,
)

init()
Expand Down Expand Up @@ -41,7 +43,7 @@
file_handler(file) - handles the file extenstion upon import.
paint_text(text, color, print_trigger = True) - paints the text with a desired color ('r', 'g', 'b', 'k', 'c', 'm', 'y').
paint_text(text, color, print_trigger) - paints the text with a desired color ('fr', 'fg', 'fb', 'fk', 'fc', 'fm', 'fy', 'br', 'bg', 'bb', 'bk', 'bc', 'bm', 'by').
'''

Expand Down Expand Up @@ -188,19 +190,43 @@ def save_to(file, prefix, func_name, choice):
else:
print('=== NO OPTION CHOSEN, EXITING THE MENU... ===\n')

#p aints the text with a desired color ('r', 'g', 'b', 'k', 'c', 'm', 'y').
def paint_text(text, color, print_trigger = True):
colors = {'r': Fore.RED,
'g' : Fore.GREEN,
'b' : Fore.BLUE,
'k' : Fore.BLACK,
'm' : Fore.MAGENTA,
'y' : Fore.YELLOW,
'c' : Fore.CYAN,
}

if print_trigger == True:
return print(colors[color] + text + Fore.RESET)

elif print_trigger == False:
return colors[color] + text + Fore.RESET
# paints the text with a desired color ('fr', 'fg', 'fb', 'fk', 'fc', 'fm', 'fy', 'br', 'bg', 'bb', 'bk', 'bc', 'bm', 'by').
def paint_text(
text : StringType,
color : StringType,
print_trigger : BooleanType = True
) -> StringType:

'''
* coloring of CLI.
- text - desired text to print.
- color - desired color to print in.
- print_trigger (True/False) - modify return type.
'''

# Fore coloring.
colors = {
'Fr' : Fore.RED,
'Fg' : Fore.GREEN,
'Fb' : Fore.BLUE,
'Fk' : Fore.BLACK,
'Fm' : Fore.MAGENTA,
'Fy' : Fore.YELLOW,
'Fc' : Fore.CYAN,

# Back coloring.
'Br' : Back.RED,
'Bg' : Back.GREEN,
'Bb' : Back.BLUE,
'Bk' : Back.BLACK,
'Bm' : Back.MAGENTA,
'By' : Back.YELLOW,
'Bc' : Back.CYAN,
}

if print_trigger == True:
return print(colors[color] + str(text) + Style.RESET_ALL)

elif print_trigger == False:
return colors[color] + str(text) + Style.RESET_ALL
2 changes: 1 addition & 1 deletion vandal/misc/_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

]
__license__ = 'Copyright © 2021-2022 David Kundih. All rights reserved. Licensed under the Apache License, Version 2.0 | For more details about the license and terms of use visit the official vandal documentation linked at https://github.com/dkundih/vandal and https://pypi.org/project/vandal'
__version__ = '3.8.9'
__version__ = '3.8.10'
__documentation__ = 'https://github.com/dkundih/vandal | https://pypi.org/project/vandal'
__contact__ = 'dakundih@unin.hr | kundihdavid@gmail.com'
__donate__ = 'https://patreon.com/dkundih | https://buymeacoffee.com/dkundih'
Expand Down
4 changes: 3 additions & 1 deletion vandal/objects/eoq.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# coloring.
from colorama import (
Fore,
Back,
Style,
init,
)
)

init()

Expand Down
4 changes: 3 additions & 1 deletion vandal/objects/montecarlo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# coloring.
from colorama import (
Fore,
Back,
Style,
init,
)
)

init()

Expand Down

0 comments on commit 669ec96

Please sign in to comment.