def create_cube(resolution=2): res = 2 ** resolution print(f"Resolution {resolution} generates RGB file with {(2**7)**3} colors") if resolution >= 7: print( "\x1b[38;2;0;255;250m Need to create RGB memory file. Expected size: up to 300mb \x1b[39m" ) cube = np.chararray(shape=[res, res, res], itemsize=19) cube = cube.astype("|S19") rd = int(256 / (2 ** resolution)) for x in tqdm(range(res)): for y in range(res): for z in range(res): fg.set_style("colorr", RgbFg(z * rd, y * rd, x * rd)) cube[x, y, z] = fg.colorr.replace("38", "38") np.save(f"color_{resolution}.npy", cube.astype("|S19")) return cube.astype("<U19")
import time from configparser import ConfigParser from datetime import datetime, timedelta from pathlib import Path from shutil import rmtree from subprocess import CompletedProcess from zipfile import ZipFile, ZIP_BZIP2 from time import sleep import signal import psutil import requests from dateutil.relativedelta import relativedelta from sty import fg, RgbFg fg.set_style("orange", RgbFg(255, 150, 50)) config = None def get_config(section: str, config_name: str) -> str: global config if config is None: config = ConfigParser() config.read("config.ini") return config[section][config_name] def format_seconds(seconds: float) -> str: seconds = math.fabs(seconds) if seconds > 3600: return f"{seconds / 3600} hours"
print("\n\nGETTING STARTED\n" + "=" * 80) # ===== Start ===== Example("gettings started: sty all the strings") from sty import fg, bg, ef, rs, RgbFg foo = fg.red + 'This is red text!' + fg.rs bar = bg.blue + 'This has a blue background!' + bg.rs baz = ef.italic + 'This is italic text' + rs.italic qux = fg(201) + 'This is pink text using 8bit colors' + fg.rs qui = fg(255, 10, 10) + 'This is red text using 24bit colors.' + fg.rs # Add new colors: fg.set_style('orange', RgbFg(255, 150, 50)) buf = fg.orange + 'Yay, Im orange.' + fg.rs print(foo, bar, baz, qux, qui, buf, sep='\n') # ===== End ===== # ===== Start ===== Example("gettings started: select dynamically") a = ef('italic') + 'Italic text.' + rs.italic b = fg('blue') + 'Blue text.' + rs.fg c = bg(randint(0, 254)) + 'Random colored bg' + rs.bg print(a, b, c, sep='\n') # ===== End =====
fg = fg_obj.as_namedtuple() a = fg.yellow + "I have a yellow fg." + fg.rs print(a) # ===== End ===== # ===== Start ===== Example("copy") from sty import fg as fg_a, RgbFg, FgRegister fg_b = fg_a fg_c = fg_a.copy() fg_a.set_style('orange', RgbFg(240, 100, 100)) a = fg_a.orange + "I have an orange fg." + fg.rs b = fg_b.orange + "I have an orange fg too." + fg.rs print(a, b, sep="\n") try: msg = "But I have no orange fg, because I'm an earlier copy." fg_c.orange + msg + fg.rs except AttributeError: print(msg) # # ===== End =====
def create_basic_color(rgb): fg.set_style("colorr", RgbFg(*rgb)) c = fg.colorr.replace("38", "38") return c
import pypresence from pypresence import Presence import tkinter as tk import time from random import randint import sty from sty import fg, RgbFg from tkinter import Tk #connecting to discord client_id = '785245597279846442' RPC = Presence(client_id) RPC.connect() #color varibles fg.set_style('eCDP_Cyan', RgbFg(96, 136, 184)) cyan = fg.eCDP_Cyan + 'Thank You For Using My Rich Presence!' + fg.rs fg.set_style('killConnect_Cyan', RgbFg(71, 180, 255)) cyanB = fg.killConnect_Cyan + 'Connection Will Close Shortly!' fg.set_style('startUp', RgbFg(0, 88, 136)) start = fg.startUp + 'Starting Up!' fg.set_style('statUp', RgbFg(232, 104, 168)) stat = fg.statUp + 'Status Updated!' #setting the base rich presence RPC.update(state="In Menus", details="Playing the eCrew Development Program", large_image="ecdp_ico",
from sty import fg, ef, rs, Style, RgbFg, Sgr fg.blue_bold = Style(RgbFg(0, 100, 200), Sgr(1)) fg.green_italic = Style(fg.green, ef.i) a = fg.blue_bold + 'This text has bold blue fg.' + rs.all b = fg.green_italic + 'This text has italic green fg' + rs.all print(a, b, sep='\n') # ===== End ===== # ===== Start ===== Example("customizing the register-objects: set_style") from sty import fg, RgbFg fg.set_style('my_red', RgbFg(255, 0, 0)) a = fg.my_red + 'This text has red fg.' + fg.rs print(a) # ===== End ===== # ===== Start ===== Example("customizing the register-objects: render_types") from sty import fg, Sgr, RgbFg, EightbitFg fg.set_style('my_sgr_red', Sgr(31)) fg.set_style('my_eightbit_red', EightbitFg(196)) fg.set_style('my_rgb_red', RgbFg(255, 0, 0)) a = fg.my_sgr_red + 'This text has a red fg.' + fg.rs
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.''' from pypresence import Presence import time import sty from sty import fg, RgbFg client_id = '786012261964709888' RPC = Presence(client_id) RPC.connect() fg.set_style('statSet', RgbFg(66, 135, 245)) stat = fg.statSet + 'Status Set!' fg.set_style('startUp', RgbFg(57, 230, 106)) start = fg.startUp + 'Starting Up!' print(start) time.sleep(1) RPC.update(state="Receiving Therapy", details="eCrew Therapy Program", large_image="cus_up", large_text="HIM", small_image="fail", small_text="Failure") print(stat)