summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteh_coderer <me@tehcoderer.com>2023-05-04 11:39:06 -0400
committerteh_coderer <me@tehcoderer.com>2023-05-04 11:39:06 -0400
commit61093518b37e649cd43b2f56dbce0648d9ee4e6e (patch)
treef8372b297e70bcd1b1c65bcdbb61cbddf4e7aacc
parent53ba74974381ebde564587aac3c6400ba1f0c049 (diff)
Update plotly_helper.py
-rw-r--r--openbb_terminal/core/plots/plotly_helper.py11
1 files changed, 9 insertions, 2 deletions
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