""" Trading terminal dark theme for the Streamlit dashboard. Bloomberg/TradingView-inspired aesthetic with green/amber accents. Uses CSS variables for consistency and injects custom fonts. """ # -- Color Tokens -- COLORS = { "bg_primary": "#0a0e17", "bg_secondary": "#111827", "bg_card": "#1a2234", "bg_card_hover": "#1f2b42", "bg_input": "#151d2e", "border": "#2a3548", "border_active": "#3b82f6", "text_primary": "#e2e8f0", "text_secondary": "#94a3b8", "text_muted": "#64748b", "green": "#22c55e", "green_dim": "#16a34a", "green_glow": "rgba(34, 197, 94, 0.15)", "red": "#ef4444", "red_dim": "#dc2626", "red_glow": "rgba(239, 68, 68, 0.15)", "amber": "#f59e0b", "amber_dim": "#d97706", "blue": "#3b82f6", "blue_dim": "#2563eb", "cyan": "#06b6d4", "purple": "#a855f7", } def get_plotly_template(): """Return a Plotly layout template matching the terminal theme.""" return dict( paper_bgcolor=COLORS["bg_card"], plot_bgcolor=COLORS["bg_card"], font=dict( family="JetBrains Mono, SF Mono, Menlo, monospace", color=COLORS["text_secondary"], size=11, ), xaxis=dict( gridcolor="rgba(42, 53, 72, 0.5)", zerolinecolor=COLORS["border"], showgrid=True, gridwidth=1, ), yaxis=dict( gridcolor="rgba(42, 53, 72, 0.5)", zerolinecolor=COLORS["border"], showgrid=True, gridwidth=1, ), margin=dict(l=0, r=0, t=32, b=0), hoverlabel=dict( bgcolor=COLORS["bg_secondary"], font_color=COLORS["text_primary"], bordercolor=COLORS["border"], ), colorway=[ COLORS["green"], COLORS["blue"], COLORS["amber"], COLORS["cyan"], COLORS["purple"], COLORS["red"], ], ) GLOBAL_CSS = f""" """ def kpi_card(label: str, value: str, delta: str = "", color: str = "blue") -> str: """Render a custom KPI card as HTML.""" delta_class = ( "positive" if delta.startswith("+") else ("negative" if delta.startswith("-") else "neutral") ) delta_html = f'