mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-11 20:01:16 +00:00
remove colors in prompt
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
from typing import Tuple
|
||||
from prompt_toolkit import PromptSession
|
||||
from prompt_toolkit.output.color_depth import ColorDepth
|
||||
from openbb_terminal import terminal_controller
|
||||
import openbb_terminal.session.local_model as Local
|
||||
from openbb_terminal.session.session_model import (
|
||||
LoginStatus,
|
||||
color_message,
|
||||
create_session,
|
||||
get_color,
|
||||
login,
|
||||
)
|
||||
from openbb_terminal.core.config.paths import PACKAGE_DIRECTORY
|
||||
@@ -30,19 +27,16 @@ def get_user_input() -> Tuple[str, str, bool]:
|
||||
"""
|
||||
console.print("\nPlease enter your credentials:", style="info")
|
||||
|
||||
s: PromptSession = PromptSession(color_depth=ColorDepth.TRUE_COLOR)
|
||||
color = get_color()
|
||||
s: PromptSession = PromptSession()
|
||||
|
||||
email = s.prompt(
|
||||
message=color_message("> Email: ", color),
|
||||
message="> Email: ",
|
||||
)
|
||||
password = s.prompt(
|
||||
message=color_message("> Password: ", color),
|
||||
message="> Password: ",
|
||||
is_password=True,
|
||||
)
|
||||
save_str = s.prompt(
|
||||
message=color_message("> Remember me? (y/n): ", color), is_password=False
|
||||
).lower()
|
||||
save_str = s.prompt(message="> Remember me? (y/n): ", is_password=False).lower()
|
||||
save = False
|
||||
if save_str == "y":
|
||||
save = True
|
||||
|
||||
@@ -5,14 +5,11 @@ import sys
|
||||
import json
|
||||
from enum import Enum
|
||||
import matplotlib.pyplot as plt
|
||||
from prompt_toolkit import HTML
|
||||
import openbb_terminal.session.local_model as Local
|
||||
import openbb_terminal.session.hub_model as Hub
|
||||
from openbb_terminal.session.user import User
|
||||
from openbb_terminal.helper_funcs import system_clear
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.rich_config import CUSTOM_THEME
|
||||
|
||||
|
||||
# pylint: disable=consider-using-f-string
|
||||
|
||||
@@ -104,39 +101,3 @@ def logout(cls: bool = False):
|
||||
|
||||
if success:
|
||||
console.print("[green]\nLogout successful.[/green]")
|
||||
|
||||
|
||||
def get_color() -> str:
|
||||
"""Get prompt session
|
||||
|
||||
Returns
|
||||
-------
|
||||
str
|
||||
The hex color.
|
||||
"""
|
||||
hex_color = "#ffffff"
|
||||
c = CUSTOM_THEME.styles["menu"].color
|
||||
if c:
|
||||
rgb = c.triplet
|
||||
if rgb:
|
||||
hex_color = "#%02x%02x%02x" % (rgb.red, rgb.green, rgb.blue)
|
||||
|
||||
return hex_color
|
||||
|
||||
|
||||
def color_message(msg: str, color: str) -> HTML:
|
||||
"""Get colorized message
|
||||
|
||||
Parameters
|
||||
----------
|
||||
msg : str
|
||||
The message.
|
||||
color : str
|
||||
The hex color.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HTML
|
||||
The HTML message.
|
||||
"""
|
||||
return HTML(f'<style fg="{color}">{msg}</style>')
|
||||
|
||||
Reference in New Issue
Block a user