From c7c344a1e4d26c45036aedc90b0816ac5ffc2fc8 Mon Sep 17 00:00:00 2001 From: Ozi-s Date: Wed, 6 May 2026 21:04:12 +0000 Subject: [PATCH] first commit --- color-parser.py | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 color-parser.py diff --git a/color-parser.py b/color-parser.py new file mode 100644 index 0000000..bfd8744 --- /dev/null +++ b/color-parser.py @@ -0,0 +1,53 @@ +import json; +import os; +import sys; +from colorist import hex; +from colorist import ColorHex; +from colorist import BgColorHex; + +red = ColorHex("#ff0000"); +yellow = ColorHex("#ffff00"); +green = ColorHex("#00ff00"); + +def get_current_d() : + return os.getcwd(); + +print(f"{red}>>{red.OFF}{yellow} Has the directory changed?{yellow.OFF}"); +diff_d = input(f"{red}>>{red.OFF} 1 or enter -- no, 2 -- yes : {yellow.OFF}"); + +if (diff_d == 1 or diff_d == "") : + print(f"{red}>>{red.OFF}{yellow} Okey, use ~/.cache/wal/{yellow.OFF}"); + print(f"{red}>>{red.OFF}{yellow} Go to the specified directory.{yellow.OFF}"); + os.chdir('../../../../.cache/wal'); +else: + print(f"{red}>>{red.OFF}{yellow} Specify the directory: {yellow.OFF}"); + w_directory = input(); + print(f"{red}>>{red.OFF}{yellow} Go to the specified directory.{yellow.OFF}"); + os.chdir(f"{w_directory}"); + +print(f"{red}>>{red.OFF} {green}START PARSING PROCESS{green.OFF} {red}<<{red.OFF}"); + +with open("colors.json", "r") as f: + data = json.load(f); + +print(f"{red}>>{red.OFF}{yellow} Successfully.{yellow.OFF}"); +print(f"{red}>>{red.OFF}{yellow} Output.{yellow.OFF}"); + +print("Used wallpaper:",data['wallpaper']); +print(); + +print("> SPECIAL <"); + +for i in data['special'] : + bg_color = BgColorHex(data['special'][f"{i}"]); + color = ColorHex(data['special'][f"{i}"]) + print(f"{i} --> {bg_color}{color}#######{color.OFF}{bg_color.OFF}"); + +print(); +print("> COLORS <"); + +for i in data['colors'] : + bg_color = BgColorHex(data['colors'][f"{i}"]); + color = ColorHex(data['colors'][f"{i}"]) + print(f"{i} --> {bg_color}{color}#######{color.OFF}{bg_color.OFF}"); +