feat(ui): tone-based icon palette for app-tile, dark-mode aware
Adds an iconTone API (blue, violet, red, orange, amber, emerald, cyan, pink, green, neutral) to appTile() that derives both icon background and color from a single hue via color-mix(). Light mode keeps the pastel-pill look; dark mode picks subtle dark-tinted backgrounds with bright accent icons so tiles read clearly on the dark background. The existing iconBg/iconColor escape hatch stays for callers that need a custom hex (admin/stats); the nine settings tiles migrate to iconTone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
* @var string $label
|
||||
* @var string|null $count
|
||||
* @var string|null $icon
|
||||
* @var string|null $iconTone
|
||||
* @var string|null $iconBg
|
||||
* @var string|null $iconColor
|
||||
* @var string|null $class
|
||||
@@ -16,12 +17,16 @@ $href = $href ?? '#';
|
||||
$label = $label ?? '';
|
||||
$count = $count ?? null;
|
||||
$icon = $icon ?? 'bi bi-grid-1x2';
|
||||
$iconTone = $iconTone ?? null;
|
||||
$iconBg = $iconBg ?? null;
|
||||
$iconColor = $iconColor ?? null;
|
||||
$class = $class ?? '';
|
||||
$tooltip = $tooltip ?? '';
|
||||
$tooltipPos = $tooltipPos ?? 'top';
|
||||
|
||||
$allowedTones = ['blue', 'violet', 'red', 'orange', 'amber', 'emerald', 'cyan', 'pink', 'green', 'neutral'];
|
||||
$resolvedTone = is_string($iconTone) && in_array($iconTone, $allowedTones, true) ? $iconTone : null;
|
||||
|
||||
$styleParts = [];
|
||||
if ($iconBg) {
|
||||
$styleParts[] = '--tile-icon-bg:' . $iconBg;
|
||||
@@ -35,6 +40,7 @@ $style = $styleParts ? implode(';', $styleParts) . ';' : '';
|
||||
<a
|
||||
class="app-tile<?php echo $class ? ' ' . $class : ''; // raw-html-ok: internal CSS class from tile config ?>"
|
||||
href="<?php e($href); ?>"
|
||||
<?php if ($resolvedTone !== null) : ?>data-tone="<?php e($resolvedTone); ?>"<?php endif; ?>
|
||||
<?php if ($style) : ?>style="<?php e($style); ?>"<?php endif; ?>
|
||||
<?php if ($tooltip !== '') : ?>data-tooltip="<?php e($tooltip); ?>" data-tooltip-pos="<?php e($tooltipPos); ?>"<?php endif; ?>
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user