Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s
- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3) - Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung - Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü - Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person - Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“ - Benutzerverwaltung im Admin, Zugang vorläufig über is_admin - vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/ - PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung - VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
85 lines
2.8 KiB
JavaScript
85 lines
2.8 KiB
JavaScript
import {
|
|
argbFromHex,
|
|
hexFromArgb,
|
|
Hct,
|
|
MaterialDynamicColors,
|
|
SchemeTonalSpot,
|
|
} from '@material/material-color-utilities';
|
|
|
|
/**
|
|
* Material-3-Rollen, die als Vuetify-Farben bereitgestellt werden.
|
|
* Schlüssel = Vuetify-Farbname, Wert = Rolle aus MaterialDynamicColors.
|
|
*/
|
|
const ROLES = {
|
|
primary: 'primary',
|
|
'on-primary': 'onPrimary',
|
|
'primary-container': 'primaryContainer',
|
|
'on-primary-container': 'onPrimaryContainer',
|
|
secondary: 'secondary',
|
|
'on-secondary': 'onSecondary',
|
|
'secondary-container': 'secondaryContainer',
|
|
'on-secondary-container': 'onSecondaryContainer',
|
|
tertiary: 'tertiary',
|
|
'on-tertiary': 'onTertiary',
|
|
'tertiary-container': 'tertiaryContainer',
|
|
'on-tertiary-container': 'onTertiaryContainer',
|
|
error: 'error',
|
|
'on-error': 'onError',
|
|
'error-container': 'errorContainer',
|
|
'on-error-container': 'onErrorContainer',
|
|
background: 'background',
|
|
'on-background': 'onBackground',
|
|
surface: 'surface',
|
|
'on-surface': 'onSurface',
|
|
'surface-variant': 'surfaceVariant',
|
|
'on-surface-variant': 'onSurfaceVariant',
|
|
'surface-bright': 'surfaceBright',
|
|
'surface-dim': 'surfaceDim',
|
|
'surface-container-lowest': 'surfaceContainerLowest',
|
|
'surface-container-low': 'surfaceContainerLow',
|
|
'surface-container': 'surfaceContainer',
|
|
'surface-container-high': 'surfaceContainerHigh',
|
|
'surface-container-highest': 'surfaceContainerHighest',
|
|
'inverse-surface': 'inverseSurface',
|
|
'inverse-on-surface': 'inverseOnSurface',
|
|
'inverse-primary': 'inversePrimary',
|
|
outline: 'outline',
|
|
'outline-variant': 'outlineVariant',
|
|
};
|
|
|
|
/**
|
|
* Berechnet aus einer Seed-Farbe das komplette Material-3-Farbschema
|
|
* (Dynamic Color, Variante „Tonal Spot“).
|
|
*
|
|
* @param {string} seedHex z. B. "#2E6B5E"
|
|
* @param {boolean} isDark
|
|
* @returns {Record<string, string>} Vuetify-Farben
|
|
*/
|
|
export function materialColors(seedHex, isDark) {
|
|
const scheme = new SchemeTonalSpot(Hct.fromInt(argbFromHex(seedHex)), isDark, 0);
|
|
const colors = {};
|
|
|
|
for (const [name, role] of Object.entries(ROLES)) {
|
|
colors[name] = hexFromArgb(MaterialDynamicColors[role].getArgb(scheme));
|
|
}
|
|
|
|
// Vuetify nutzt „surface-light“ z. B. für Chips und Hover-Flächen.
|
|
colors['surface-light'] = colors['surface-container-high'];
|
|
|
|
// Statusfarben ohne M3-Entsprechung: auf die Palette abgestimmte Töne.
|
|
colors.info = isDark ? '#9ECAFF' : '#0061A4';
|
|
colors.success = isDark ? '#7DDC7A' : '#1E6C23';
|
|
colors.warning = isDark ? '#FFB86E' : '#8B5000';
|
|
|
|
return colors;
|
|
}
|
|
|
|
/**
|
|
* @param {string} seedHex
|
|
*/
|
|
export function vuetifyThemes(seedHex) {
|
|
return {
|
|
light: { dark: false, colors: materialColors(seedHex, false) },
|
|
dark: { dark: true, colors: materialColors(seedHex, true) },
|
|
};
|
|
}
|