fix: sidebar color consistente en todas las páginas + gradiente más oscuro

- 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 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-06-23 21:02:55 -05:00
co-authored by Claude Sonnet 4.6
parent 406d542042
commit 935cea24b6
2 changed files with 23 additions and 1 deletions
+1 -1
View File
@@ -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;
+22
View File
@@ -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 "<style>:root{--brand:{$_sb_brand};--brand-dark:{$_sb_brand_dark}}</style>\n";
}
// Ruta del script que está siendo cargado actualmente
$_current_script = basename($_SERVER['PHP_SELF']);