From 935cea24b6850de761bef4aaa0b864674c568baf Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Tue, 23 Jun 2026 21:02:55 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20sidebar=20color=20consistente=20en=20tod?= =?UTF-8?q?as=20las=20p=C3=A1ginas=20+=20gradiente=20m=C3=A1s=20oscuro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sidebar.php inyecta --brand/--brand-dark desde DB si no fueron definidos ya por Layout.php, solucionando que lab_*.php mostraran el sidebar azul (fallback) mientras las páginas ERP mostraban verde (#a0a59c del doc_color) - Gradiente del sidebar invertido: ahora va de más oscuro (top) a brand (bottom) en lugar de terminar con mezcla blanca que perdía las letras Co-Authored-By: Claude Sonnet 4.6 --- assets/css/styles.css | 2 +- shared/components/sidebar.php | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/assets/css/styles.css b/assets/css/styles.css index da5ead0..7d9ff7b 100644 --- a/assets/css/styles.css +++ b/assets/css/styles.css @@ -51,7 +51,7 @@ body { top: 0; width: var(--sidebar-width, 270px); height: 100vh; - background: linear-gradient(160deg, var(--brand-dark, #0d47a1) 0%, var(--brand, #1565c0) 60%, color-mix(in srgb, var(--brand, #1565c0) 75%, #fff) 100%); + background: linear-gradient(160deg, color-mix(in srgb, var(--brand-dark, #0d47a1) 80%, #000) 0%, var(--brand-dark, #0d47a1) 55%, var(--brand, #1565c0) 100%); color: white; z-index: 1000; overflow-y: auto; diff --git a/shared/components/sidebar.php b/shared/components/sidebar.php index dbdb239..51631ba 100644 --- a/shared/components/sidebar.php +++ b/shared/components/sidebar.php @@ -26,6 +26,28 @@ if (!class_exists('ModuleRegistry', false)) { } } +// ── Brand color desde DB (si no fue inyectado ya por Layout.php) ───────────── +if (!defined('_SIDEBAR_BRAND_INJECTED')) { + define('_SIDEBAR_BRAND_INJECTED', true); + $_sb_brand = '#1565c0'; + $_sb_brand_dark = '#0d47a1'; + try { + if (class_exists('Database', false)) { + $_sb_row = Database::getInstance()->fetch("SELECT valor FROM lab_config WHERE clave = 'doc_color'"); + if ($_sb_row && preg_match('/^#[0-9a-fA-F]{3,8}$/', $_sb_row['valor'])) { + $_sb_brand = $_sb_row['valor']; + $_sb_hex = ltrim($_sb_brand, '#'); + $_sb_brand_dark = sprintf('#%02x%02x%02x', + max(0, hexdec(substr($_sb_hex, 0, 2)) - 40), + max(0, hexdec(substr($_sb_hex, 2, 2)) - 40), + max(0, hexdec(substr($_sb_hex, 4, 2)) - 40) + ); + } + } + } catch (\Throwable $_) {} + echo "\n"; +} + // Ruta del script que está siendo cargado actualmente $_current_script = basename($_SERVER['PHP_SELF']);