Improve code for ease of color change

This commit is contained in:
Ferit Yiğit BALABAN 2022-03-31 16:36:22 +03:00
parent 2a9339ca83
commit 6f1cdfdaac
No known key found for this signature in database
GPG Key ID: BB8494BA65A90842

60
fetchpy
View File

@ -4,23 +4,21 @@
# #
# fetchpy, fetch script alternative to neofetch # fetchpy, fetch script alternative to neofetch
import os import os
import sys
import subprocess as sp import subprocess as sp
from termcolor import cprint
from rich.console import Console from rich.console import Console
from rich.traceback import install from rich.traceback import install
install(show_locals=True) install(show_locals=True)
def coloring(text): def coloring(text):
red = '#FF0018' color1 = '#' + '785BAF'
orange = '#FFA52C' color2 = '#' + 'DF73AA'
yellow = '#FFFF41' color3 = '#' + 'B6D871'
green = '#008018' color4 = '#' + 'F1E7C2'
blue = '#0000F9' color5 = '#' + '77B2CC'
frame = 'red' frame = color2
info = 'yellow' info = color3
title = 'yellow' title = color5
color_dictionary = { color_dictionary = {
'╭': frame, '╭': frame,
'╰': frame, '╰': frame,
@ -42,27 +40,27 @@ def coloring(text):
'UPT': info, 'UPT': info,
'ferit@navi': title, 'ferit@navi': title,
'Hardware': title, 'Hardware': title,
'-@\n': red, '-@\n': color1,
'.##@': red, '.##@': color1,
'.####@': red, '.####@': color1,
'@#####@': orange, '@#####@': color2,
'.**######@': orange, '.**######@': color2,
'.##@o@#####@': orange, '.##@o@#####@': color2,
'.############@': yellow, '.############@': color3,
'.##############@': yellow, '.##############@': color3,
'@######@**%######@': yellow, '@######@**%######@': color3,
'@######`': green, '@######`': color4,
'%#####o': green, '%#####o': color4,
'@######@': green, '@######@': color4,
'######%': green, '######%': color4,
'-@#######h': green, '-@#######h': color4,
'######@.`': green, '######@.`': color4,
'.#####h**``': blue, '.#####h**``': color5,
'`**%@####@': blue, '`**%@####@': color5,
'@H@*`': blue, '@H@*`': color5,
'*`': blue, '*`': color5,
'`*%#@': blue, '`*%#@': color5,
'`*': blue, '`*': color5,
} }
c = Console() c = Console()
iterator = 0 iterator = 0