Add color utility functions and theme palette integration
- Introduced utility functions for color manipulation: `fhHexToRgb`, `fhRgbToHex`, `fhMixHex`, `fhRelativeLuminance`, and `fhContrastText`. - Implemented a comprehensive theme palette based on the user's favorite color, including primary, secondary, and semantic colors. - Updated CSS variables in the stylesheet to reflect the new theme structure, enhancing consistency across the UI. - Modified header to dynamically apply theme styles based on the generated palette, improving visual coherence.
This commit is contained in:
+60
-1
@@ -13,7 +13,66 @@
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<link rel="stylesheet" href="assets/css/style.css">
|
||||
</head>
|
||||
<body class="family-hub-body <?= htmlspecialchars($headerThemeClass ?? 'header-tone-dark', ENT_QUOTES, 'UTF-8') ?>" style="--person-accent: <?= htmlspecialchars($favoriteColor ?? '#4a90e2', ENT_QUOTES, 'UTF-8') ?>;">
|
||||
<?php
|
||||
$themePalette = isset($themePalette) && is_array($themePalette) ? $themePalette : [];
|
||||
$themeVars = [
|
||||
'--person-accent' => (string) ($themePalette['accent'] ?? ($favoriteColor ?? '#4a90e2')),
|
||||
'--fh-primary' => (string) ($themePalette['primary'] ?? '#4a90e2'),
|
||||
'--fh-primary-hover' => (string) ($themePalette['primary_hover'] ?? '#3e79be'),
|
||||
'--fh-primary-active' => (string) ($themePalette['primary_active'] ?? '#3567a2'),
|
||||
'--fh-primary-subtle' => (string) ($themePalette['primary_subtle'] ?? '#edf4fc'),
|
||||
'--fh-primary-border' => (string) ($themePalette['primary_border'] ?? '#c6dcf6'),
|
||||
'--fh-primary-text' => (string) ($themePalette['primary_text'] ?? '#ffffff'),
|
||||
'--fh-primary-subtle-text' => (string) ($themePalette['primary_subtle_text'] ?? '#1f2a37'),
|
||||
'--fh-secondary' => (string) ($themePalette['secondary'] ?? '#dce9f8'),
|
||||
'--fh-secondary-hover' => (string) ($themePalette['secondary_hover'] ?? '#cfdff2'),
|
||||
'--fh-secondary-active' => (string) ($themePalette['secondary_active'] ?? '#c0d3ea'),
|
||||
'--fh-secondary-border' => (string) ($themePalette['secondary_border'] ?? '#b4c9e3'),
|
||||
'--fh-secondary-text' => (string) ($themePalette['secondary_text'] ?? '#1f2a37'),
|
||||
'--fh-tertiary' => (string) ($themePalette['tertiary'] ?? '#f4f8fd'),
|
||||
'--fh-tertiary-hover' => (string) ($themePalette['tertiary_hover'] ?? '#e5eef9'),
|
||||
'--fh-tertiary-active' => (string) ($themePalette['tertiary_active'] ?? '#d6e5f5'),
|
||||
'--fh-tertiary-border' => (string) ($themePalette['tertiary_border'] ?? '#c6d8ee'),
|
||||
'--fh-tertiary-text' => (string) ($themePalette['tertiary_text'] ?? '#1f2a37'),
|
||||
'--fh-focus-ring' => (string) ($themePalette['focus_ring'] ?? '#89b6eb'),
|
||||
'--fh-surface-tint' => (string) ($themePalette['surface_tint'] ?? '#f7fafe'),
|
||||
'--fh-header-gradient-end' => (string) ($themePalette['header_gradient_end'] ?? '#2c5282'),
|
||||
'--fh-success' => (string) ($themePalette['success'] ?? '#198754'),
|
||||
'--fh-success-hover' => (string) ($themePalette['success_hover'] ?? '#157347'),
|
||||
'--fh-success-active' => (string) ($themePalette['success_active'] ?? '#146c43'),
|
||||
'--fh-success-subtle' => (string) ($themePalette['success_subtle'] ?? '#d1e7dd'),
|
||||
'--fh-success-border' => (string) ($themePalette['success_border'] ?? '#a3cfbb'),
|
||||
'--fh-success-text' => (string) ($themePalette['success_text'] ?? '#ffffff'),
|
||||
'--fh-success-subtle-text' => (string) ($themePalette['success_subtle_text'] ?? '#0f5132'),
|
||||
'--fh-warning' => (string) ($themePalette['warning'] ?? '#f59e0b'),
|
||||
'--fh-warning-hover' => (string) ($themePalette['warning_hover'] ?? '#d97706'),
|
||||
'--fh-warning-active' => (string) ($themePalette['warning_active'] ?? '#b45309'),
|
||||
'--fh-warning-subtle' => (string) ($themePalette['warning_subtle'] ?? '#fff3cd'),
|
||||
'--fh-warning-border' => (string) ($themePalette['warning_border'] ?? '#ffe69c'),
|
||||
'--fh-warning-text' => (string) ($themePalette['warning_text'] ?? '#111827'),
|
||||
'--fh-warning-subtle-text' => (string) ($themePalette['warning_subtle_text'] ?? '#664d03'),
|
||||
'--fh-danger' => (string) ($themePalette['danger'] ?? '#dc3545'),
|
||||
'--fh-danger-hover' => (string) ($themePalette['danger_hover'] ?? '#bb2d3b'),
|
||||
'--fh-danger-active' => (string) ($themePalette['danger_active'] ?? '#b02a37'),
|
||||
'--fh-danger-subtle' => (string) ($themePalette['danger_subtle'] ?? '#f8d7da'),
|
||||
'--fh-danger-border' => (string) ($themePalette['danger_border'] ?? '#f1aeb5'),
|
||||
'--fh-danger-text' => (string) ($themePalette['danger_text'] ?? '#ffffff'),
|
||||
'--fh-danger-subtle-text' => (string) ($themePalette['danger_subtle_text'] ?? '#842029'),
|
||||
'--fh-info' => (string) ($themePalette['info'] ?? '#0ea5e9'),
|
||||
'--fh-info-hover' => (string) ($themePalette['info_hover'] ?? '#0b84bd'),
|
||||
'--fh-info-active' => (string) ($themePalette['info_active'] ?? '#0a6f9f'),
|
||||
'--fh-info-subtle' => (string) ($themePalette['info_subtle'] ?? '#cff4fc'),
|
||||
'--fh-info-border' => (string) ($themePalette['info_border'] ?? '#9eeaf9'),
|
||||
'--fh-info-text' => (string) ($themePalette['info_text'] ?? '#ffffff'),
|
||||
'--fh-info-subtle-text' => (string) ($themePalette['info_subtle_text'] ?? '#055160'),
|
||||
];
|
||||
$bodyStyleParts = [];
|
||||
foreach ($themeVars as $varName => $varValue) {
|
||||
$bodyStyleParts[] = $varName . ': ' . $varValue;
|
||||
}
|
||||
$bodyStyle = implode('; ', $bodyStyleParts) . ';';
|
||||
?>
|
||||
<body class="family-hub-body <?= htmlspecialchars($headerThemeClass ?? 'header-tone-dark', ENT_QUOTES, 'UTF-8') ?>" style="<?= htmlspecialchars($bodyStyle, ENT_QUOTES, 'UTF-8') ?>">
|
||||
<?php $hideTopHeader = !empty($isCalendarTvView); ?>
|
||||
<?php if (!$hideTopHeader): ?>
|
||||
<header class="app-header app-header-with-tabs text-white pt-3 px-3 pb-2 mb-0">
|
||||
|
||||
Reference in New Issue
Block a user