Hardcode fixed brand palette (retire per-restaurant palette)
Colors are now fixed from the design mockups instead of the per-restaurant palette: white background, red #dc2626 accent. paletteToCssVars() ignores the stored palette and always emits the fixed tokens (covers both the public and editor pages), and globals.css :root matches. The palette editor section will be removed separately. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
58a71d0bef
commit
bcec7ee8dc
3 files changed
+26
-37
No files matched your search
+7
-5
@@ -86,14 +86,16 @@ en `Editor.tsx` (clases `.dock-*`).
|
||||
La estética es **glassmorphism claro/transparente con animaciones high-end**. No
|
||||
introducir un look nuevo sin pedirlo.
|
||||
|
||||
### Tokens de color (CSS vars en `globals.css`)
|
||||
La paleta del restaurante es **configurable en runtime** vía estas variables — úsalas,
|
||||
no hardcodees colores de marca:
|
||||
### Tokens de color (CSS vars en `globals.css`) — FIJOS (paleta retirada)
|
||||
Los colores son **fijos** (hardcodeados del mockup); ya **no** se configuran por
|
||||
restaurante. Definidos en `:root` (`globals.css`) y forzados por `paletteToCssVars()`
|
||||
(que ignora la paleta guardada). Úsalos vía `var(--…)`:
|
||||
|
||||
```
|
||||
--bg, --bg-2 fondos --surface cristal
|
||||
--accent acento --text texto --tab píldoras
|
||||
--bg #ffffff --bg-2 #ffffff --surface rgba(255,255,255,.55)
|
||||
--accent #dc2626 (rojo) --text #2a2520 --tab rgba(255,255,255,.45)
|
||||
```
|
||||
> La sección de Paleta del editor se eliminará por completo (lo hará el dueño del repo).
|
||||
|
||||
> **Acción primaria = rojo `#dc2626` hardcodeado** (rediseño): botones "Agregar a mi
|
||||
> orden", FAB "Orden", CTA de la landing, "Guardar y publicar", login, etc. NO usan
|
||||
|
||||
+5
-4
@@ -3,11 +3,12 @@
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
/* Default restaurant palette (overridden per-restaurant at runtime). */
|
||||
--bg: #f4f1ec;
|
||||
--bg-2: #e9e3da;
|
||||
/* Fixed brand palette — hardcoded from the design mockups. The per-restaurant
|
||||
palette feature is being retired, so these are no longer overridden at runtime. */
|
||||
--bg: #ffffff;
|
||||
--bg-2: #ffffff;
|
||||
--surface: rgba(255, 255, 255, 0.55);
|
||||
--accent: #b45309;
|
||||
--accent: #dc2626;
|
||||
--text: #2a2520;
|
||||
--tab: rgba(255, 255, 255, 0.45);
|
||||
}
|
||||
|
||||
+14
-28
@@ -29,33 +29,19 @@ export const PALETTE_PRESETS: { id: string; label: string; palette: Palette }[]
|
||||
},
|
||||
];
|
||||
|
||||
const DEFAULT = PALETTE_PRESETS[0].palette;
|
||||
// FIXED brand palette — the per-restaurant palette feature is being retired, so
|
||||
// these colors are hardcoded from the approved design mockups and the argument is
|
||||
// ignored. Emitted into :root (public) and [data-editor-root] (editor).
|
||||
const FIXED_VARS =
|
||||
'--bg:#ffffff;' +
|
||||
'--bg-2:#ffffff;' +
|
||||
'--surface:rgba(255,255,255,0.55);' +
|
||||
'--accent:#dc2626;' +
|
||||
'--text:#2a2520;' +
|
||||
'--tab:rgba(255,255,255,0.45);';
|
||||
|
||||
// Build a CSS variable string from a palette, deriving a darker bottom gradient.
|
||||
export function paletteToCssVars(palette?: Palette): string {
|
||||
const p = { ...DEFAULT, ...(palette ?? {}) };
|
||||
return [
|
||||
`--bg:${p.background};`,
|
||||
`--bg-2:${shade(p.background!, -8)};`,
|
||||
`--surface:${p.surface};`,
|
||||
`--accent:${p.accent};`,
|
||||
`--text:${p.text};`,
|
||||
`--tab:${p.tab};`,
|
||||
].join('');
|
||||
}
|
||||
|
||||
// Lighten/darken a hex color by a percentage (-100..100).
|
||||
function shade(hex: string, percent: number): string {
|
||||
const m = hex.replace('#', '');
|
||||
if (m.length !== 6) return hex;
|
||||
const num = parseInt(m, 16);
|
||||
const amt = Math.round(2.55 * percent);
|
||||
const r = clamp((num >> 16) + amt);
|
||||
const g = clamp(((num >> 8) & 0xff) + amt);
|
||||
const b = clamp((num & 0xff) + amt);
|
||||
return `#${((r << 16) | (g << 8) | b).toString(16).padStart(6, '0')}`;
|
||||
}
|
||||
|
||||
function clamp(v: number): number {
|
||||
return Math.max(0, Math.min(255, v));
|
||||
// Kept for signature compatibility with the pages that still call it; the passed
|
||||
// palette is intentionally ignored now that colors are fixed.
|
||||
export function paletteToCssVars(_palette?: Palette): string {
|
||||
return FIXED_VARS;
|
||||
}
|
||||
Reference in new issue
Block a user