""" theme.py — Sistema de diseño de la nueva interfaz. Un único lugar para los colores de marca y UNA plantilla Plotly reutilizable. Antes cada figura se estilizaba inline y se repetían colores; aquí se centraliza. """ import plotly.graph_objects as go import plotly.io as pio # ------------------------------------------------------------------ # Tokens de color (marca CHRONOFLUX / Rizek) # ------------------------------------------------------------------ PALETTE = { "brand": "#AF1E2D", # rojo de marca "brand_dark": "#901924", "ink": "#0F172A", # texto/encabezados "ink_soft": "#1E293B", "slate": "#334155", "slate_500": "#64748B", "slate_400": "#94A3B8", "line": "#E2E8F0", # bordes/grillas "surface": "#FFFFFF", "surface_2": "#F1F5F9", "page": "#F8FAFC", # Semánticos (riesgo) "ok": "#16A34A", "ok_soft": "#BBF7D0", "warn": "#D97706", "warn_soft": "#FDE2B4", "danger": "#AF1E2D", "danger_soft": "#F8B4B4", "info": "#0EA5E9", "info_soft": "#F0F9FF", } # Mapa semántico de categorías del Gantt (encoda significado, no secuencia) RISK_COLORS = { "Crítica": PALETTE["brand"], # ruta crítica "Impactada": PALETTE["warn"], # con impacto pero con holgura "Normal": PALETTE["slate_400"], } FONT_FAMILY = "Inter, -apple-system, Segoe UI, Roboto, sans-serif" def _make_template() -> go.layout.Template: t = go.layout.Template() t.layout = go.Layout( font=dict(family=FONT_FAMILY, size=13, color=PALETTE["slate"]), paper_bgcolor="rgba(0,0,0,0)", plot_bgcolor="rgba(0,0,0,0)", colorway=[ PALETTE["brand"], PALETTE["info"], PALETTE["slate_500"], PALETTE["warn"], PALETTE["ok"], PALETTE["ink"], ], margin=dict(l=10, r=10, t=40, b=10), title=dict(font=dict(size=16, color=PALETTE["ink"]), x=0.01, xanchor="left"), xaxis=dict(gridcolor=PALETTE["line"], zeroline=False, linecolor=PALETTE["line"], tickfont=dict(color=PALETTE["slate_500"])), yaxis=dict(gridcolor=PALETTE["line"], zeroline=False, linecolor=PALETTE["line"], tickfont=dict(color=PALETTE["slate_500"])), legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1, font=dict(color=PALETTE["slate_500"])), hoverlabel=dict(font=dict(family=FONT_FAMILY, size=12)), ) return t # Registrar y fijar como plantilla por defecto del proceso. pio.templates["chronoflux"] = _make_template() pio.templates.default = "chronoflux" TEMPLATE = "chronoflux"