From 6eac499ae0bd8e65659881d4480eba3f6c66f0eb Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 25 Feb 2023 11:29:46 +0000 Subject: [PATCH] Add new config option to set the terminal bg color This is a hacky way to do it, but it works surprisingly well, considering there's no true way to modify a terminal's fully color scheme. --- devine/core/config.py | 1 + devine/core/console.py | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/devine/core/config.py b/devine/core/config.py index 2dd1f7c..5a55830 100644 --- a/devine/core/config.py +++ b/devine/core/config.py @@ -62,6 +62,7 @@ class Config: self.proxy_providers: dict = kwargs.get("proxy_providers") or {} self.serve: dict = kwargs.get("serve") or {} self.services: dict = kwargs.get("services") or {} + self.set_terminal_bg: bool = kwargs.get("set_terminal_bg", True) self.tag: str = kwargs.get("tag") or "" @classmethod diff --git a/devine/core/console.py b/devine/core/console.py index b1eec92..46d2633 100644 --- a/devine/core/console.py +++ b/devine/core/console.py @@ -1,6 +1,8 @@ from rich.console import Console from rich.theme import Theme +from devine.core.config import config + catppuccin_mocha = { # Colors based on "CatppuccinMocha" from Gogh themes @@ -30,10 +32,14 @@ primary_scheme["bright_yellow"] = primary_scheme["yellow"] primary_scheme["bright_blue"] = primary_scheme["blue"] primary_scheme["bright_magenta"] = primary_scheme["pink"] primary_scheme["bright_cyan"] = primary_scheme["cyan"] +if config.set_terminal_bg: + primary_scheme["none"] += f" on {primary_scheme['bg']}" custom_colors = { "ascii.art": primary_scheme["pink"] } +if config.set_terminal_bg: + custom_colors["ascii.art"] += f" on {primary_scheme['bg']}" console = Console(