diff --git a/openbb_terminal/core/plots/plotly_helper.py b/openbb_terminal/core/plots/plotly_helper.py index 21c48e72d68..a74589d5a7f 100644 --- a/openbb_terminal/core/plots/plotly_helper.py +++ b/openbb_terminal/core/plots/plotly_helper.py @@ -78,6 +78,12 @@ class TerminalStyle: line_width: float = 1.5 + def __new__(cls, *args, **kwargs): # pylint: disable=W0613 + """Create a singleton.""" + if not hasattr(cls, "instance"): + cls.instance = super().__new__(cls) # pylint: disable=E1120 + return cls.instance + def __init__( self, plt_style: Optional[str] = "", @@ -247,8 +253,9 @@ class TerminalStyle: list List of colors e.g. ["#00ACFF", "#FF0000"] """ - self.apply_style() - colors = self.plotly_template.get("layout", {}).get("colorway", PLT_COLORWAY) + colors = ( + self.plotly_template.get("layout", {}).get("colorway", PLT_COLORWAY).copy() + ) if reverse: colors.reverse() return colors