Make it easier for users to configure their terminal colors (#2740)

* Make it easier for users to configure their terminal colors

* smaller version of text

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
This commit is contained in:
DidierRLopes
2022-10-09 13:54:14 +02:00
committed by GitHub
parent a59e041d22
commit 9df5bdcfb6
3 changed files with 23 additions and 2 deletions

1
i18n/en.yml vendored
View File

@@ -43,6 +43,7 @@ en:
featflags/cmdloc: command location displayed in figures
featflags/tbhint: displays usage hints in a bottom toolbar
settings/_info_: Settings through environment variables
settings/colors: set your own terminal colors
settings/autoscaling: plot autoscaling
settings/dt: add or remove datetime from flair
settings/flair: set the flair emoji to be used

View File

@@ -100,7 +100,7 @@ class TerminalStyle:
"""
DEFAULT_STYLES_LOCATION = REPOSITORY_DIRECTORY / "styles" / "default"
USER_STYLES_LOCATION = USER_DATA_DIRECTORY / "styles"
USER_STYLES_LOCATION = USER_DATA_DIRECTORY / "styles" / "user"
mpl_styles_available: Dict[str, str] = {}
mpl_style: str = ""
@@ -174,7 +174,10 @@ class TerminalStyle:
self.mpf_style = json.load(stylesheet)
self.mpf_style["base_mpl_style"] = self.mpl_style
if console_style in self.console_styles_available:
if "openbb_config" in self.console_styles_available:
with open(self.console_styles_available["openbb_config"]) as stylesheet:
self.console_style = json.load(stylesheet)
elif console_style in self.console_styles_available:
with open(self.console_styles_available[console_style]) as stylesheet:
self.console_style = json.load(stylesheet)
else:

View File

@@ -54,6 +54,7 @@ class SettingsController(BaseController):
"userdata",
"source",
"flair",
"colors",
]
PATH = "/settings/"
@@ -81,6 +82,7 @@ class SettingsController(BaseController):
mt = MenuText("settings/")
mt.add_info("_info_")
mt.add_raw("\n")
mt.add_cmd("colors")
mt.add_setting("dt", obbff.USE_DATETIME)
mt.add_cmd("flair")
mt.add_raw("\n")
@@ -134,6 +136,21 @@ class SettingsController(BaseController):
console.print(text=mt.menu_text, menu="Settings")
@log_start_end(log=logger)
def call_colors(self, _):
"""Process colors command"""
console.print(
"\n1. Play with the terminal coloring embedded in our website https://openbb.co/customize\n"
)
console.print("2. Once happy, click 'Download Theme'\n")
console.print(
"3. The file 'openbb_config.richstyle.json' should be downloaded\n"
)
console.print(
"4. Insert that config file inside /OpenBBUserData/styles/user/\n"
)
console.print("5. Close the terminal and run it again.\n")
@log_start_end(log=logger)
def call_dt(self, _):
"""Process dt command"""