Salta ai contenuti
Magma Design System
Colore
Dai un nome al ruolo, non al colore. Un ruolo semantico (--magma-*) dice cos’è un elemento, una card rialzata, un testo attenuato, l’azione principale, e diventa un colore secondo la modalità, il tema e la preferenza di contrasto della pagina. Un passo della palette cambia solo con la modalità: resta grigio sotto un tema colorato e non guadagna contrasto quando l’utente ne chiede di più.
Due modi di scrivere un ruolo
Ogni ruolo è una custom property che contiene canali rgb, e un colore di Tailwind.
.panel {
background: rgb(var(--magma-surface-raised));
color: rgb(var(--magma-text-default));
border: 1px solid rgb(var(--magma-border-muted));
}
<section class="bg-surface-raised text-fg-default border border-border-muted">
<p class="text-fg-muted">Testo secondario</p>
</section>
In Tailwind i ruoli del testo sono fg-*, perché nessuna classe si legga text-text-*: --magma-text-muted è text-fg-muted. Tutti gli altri ruoli tengono il loro nome. I ruoli vengono da styles/dist/css/semantic.css, i loro colori Tailwind da styles/dist/tailwind/theme.css; il modificatore di opacità funziona come sempre (bg-surface-raised/80).
Ruoli neutri
Gli sfondi, i testi e i bordi di tutto ciò che non è né un’azione né uno stato. Un tema li ricolora tutti insieme.
Superfici
Cinque livelli, da scegliere secondo dove sta l’elemento, non secondo la tinta: default è la pagina, sunken è incassato nella pagina (pozzetti, blocchi di codice, binari), muted raggruppa sul piano della pagina (righe alternate), raised è sollevato (card, pannelli, barre fisse), overlay galleggia sopra tutto (modali, menu a tendina, popover). In modalità chiara i livelli sopra la pagina sono vicini, quindi dai a raised e overlay anche un’ombra, come fanno i componenti. --magma-surface-sunkenbg-surface-sunken#e8e8e8alias di --surface-neutral-sunken#020202Below the page: wells, insets, code blocks, tracks.
--magma-surface-mutedbg-surface-muted#ebebebalias di --surface-neutral-muted#0d0d0dSame-plane grouping on the page: zebra rows, a subtle section.
--magma-surface-defaultbg-surface-default#f2f2f2alias di --surface-neutral-default#1d1d1dThe page canvas, the background of the body.
--magma-surface-raisedbg-surface-raised#f8f8f8alias di --surface-neutral-raised#303030Above the page: cards, panels, sticky headers.
--magma-surface-overlaybg-surface-overlay#ffffffalias di --surface-neutral-overlay#4a4a4aFloating above everything: modal, dropdown, popover, sheet.
--magma-surface-inversebg-surface-inverse#2a2a2aalias di --tone-neutral-02#f4f4f4A chip that flips with the mode: dark on a light page, light on a dark one.
--magma-surface-inverse-mutedbg-surface-inverse-muted#494949alias di --tone-neutral-03#e4e4e4The inverse chip, one step quieter.
Wash
Una pillola, un chip o un hover neutro, secondo quanto deve risaltare. wash-soft regge tutta la scala del testo, wash-base solo text-default, wash-strong solo icone. --magma-wash-softbg-wash-soft#edededalias di --tone-neutral-10#3e3e3eA neutral pill or chip, the least marked.
--magma-wash-basebg-wash-base#e1e1e1alias di --tone-neutral-09#535353A neutral pill or chip, at its default prominence.
--magma-wash-strongbg-wash-strong#d0d0d0alias di --tone-neutral-08#6b6b6bA neutral pill or chip, the most marked.
Testo
text-muted è per il testo secondario ma essenziale, text-subtle solo per quello che l’utente può saltare. Ogni ruolo del testo è leggibile su tutte e cinque le superfici in entrambe le modalità. --magma-text-defaulttext-fg-default#050505alias di --text-neutral-default#fcfcfcBody text, titles and primary data.
--magma-text-mutedtext-fg-muted#494949alias di --text-neutral-muted#e4e4e4Secondary text that is still essential, such as an address or a phone number.
--magma-text-subtletext-fg-subtle#636363alias di --text-neutral-subtle#d3d3d3Non-essential text only: captions, units, hints.
--magma-text-disabledtext-fg-disabled#777777alias di --text-neutral-disabled#c4c4c4The labels of disabled controls.
--magma-text-on-emphasistext-fg-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on a solid fill.
Bordi
border-muted è decorativo (divisori, griglie delle tabelle), border-default contorna ciò che funziona (campi, card), border-strong comunica uno stato, border-focus segue l’accento. --magma-border-mutedborder-border-muted#dbdbdbalias di --border-neutral-muted#404040Decorative borders: dividers, the grid of a table.
--magma-border-defaultborder-border-default#c4c4c4alias di --border-neutral-default#6f6f6fFunctional outlines: inputs, cards.
--magma-border-strongborder-border-strong#8c8c8calias di --border-neutral-strong#abababA border that conveys a state, such as selected.
--magma-border-focusborder-border-focus#2467e7alias di --brand-maggioli-04#becadeFocus indication; follows the accent.
Altri ruoli neutri
Il chip invertito e il suo inchiostro, l’inchiostro sul velo delle modali, la selezione e il colore di un’ombra proiettata, da comporre con la tua geometria e la tua opacità. --magma-neutral-emphasis e --magma-neutral-on-emphasis sono alias deprecati di --magma-surface-inverse e --magma-on-inverse. --magma-shadow-inkshadow-shadow-ink#050505alias di --tone-neutral-01#fcfcfcThe colour of a projected shadow, to compose with your own geometry and alpha.
--magma-neutral-fgtext-neutral-fg#494949alias di --tone-neutral-03#e4e4e4Neutral text and icons on a coloured context.
--magma-neutral-borderborder-neutral-border#a5a5a5alias di --tone-neutral-06#9a9a9aA neutral border on a coloured context.
--magma-neutral-emphasisbg-neutral-emphasis#2a2a2aalias di --tone-neutral-02#f4f4f4Deprecated: the inverse surface under its old name.
--magma-neutral-on-emphasistext-neutral-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dDeprecated: the ink on the inverse surface under its old name.
--magma-on-inversetext-on-inverse#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on either inverse surface.
--magma-on-backdrop - #fcfcfc -
--magma-selection-background - #b9e7fbalias di --label-sky-09#08597e
--magma-selection-color - #043044alias di --label-sky-01#e5f6fd
Accenti
Due accenti con gli stessi nove ruoli: accent, il colore delle azioni del brand, e accent-ai, per le funzioni guidate dall’AI. -fg è inchiostro su una superficie neutra, -on-emphasis è inchiostro sul riempimento pieno: scambiarli è il modo più rapido per rompere il contrasto.
Accento
--magma-accent-surfacebg-accent-surface#dce0e7alias di --brand-maggioli-09#0446c3A background tinted with the brand accent: a selected row or chip.
--magma-accent-fgtext-accent-fg#074cccalias di --brand-maggioli-03#d5dae4Text or an icon in the brand accent on a neutral surface, such as a link.
--magma-accent-borderborder-accent-border#94acdaalias di --brand-maggioli-06#6e94dcA border tinted with the brand accent.
--magma-accent-emphasisbg-accent-emphasis#2467e7alias di --brand-maggioli-04#becadeThe solid fill of the brand accent: the primary action.
--magma-accent-emphasis-hoverbg-accent-emphasis-hover#074cccalias di --brand-maggioli-03#d5dae4The solid fill of the brand accent, hovered.
--magma-accent-emphasis-activebg-accent-emphasis-active#0039a3alias di --brand-maggioli-02#e4e6ebThe solid fill of the brand accent, pressed.
--magma-accent-surface-hoverbg-accent-surface-hover#ccd4e2alias di --brand-maggioli-08#1058e0A background tinted with the brand accent, hovered.
--magma-accent-surface-subtlebg-accent-surface-subtle#ecedf0alias di --brand-maggioli-10#003393A background tinted with the brand accent, lighter.
--magma-accent-on-emphasistext-accent-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on the solid fill of the brand accent.
Accento AI
--magma-accent-ai-surfacebg-accent-ai-surface#e5dafdalias di --label-violet-09#500de8A background tinted with the AI accent: a selected row or chip.
--magma-accent-ai-fgtext-accent-ai-fg#5714f2alias di --label-violet-03#e0d3fdText or an icon in the AI accent on a neutral surface, such as a link.
--magma-accent-ai-borderborder-accent-ai-border#b89cfaalias di --label-violet-06#a47ef8A border tinted with the AI accent.
--magma-accent-ai-emphasisbg-accent-ai-emphasis#7e49f5alias di --label-violet-04#d2c0fcThe solid fill of the AI accent: the primary action.
--magma-accent-ai-emphasis-hoverbg-accent-ai-emphasis-hover#5714f2alias di --label-violet-03#e0d3fdThe solid fill of the AI accent, hovered.
--magma-accent-ai-emphasis-activebg-accent-ai-emphasis-active#410bbealias di --label-violet-02#ebe2fdThe solid fill of the AI accent, pressed.
--magma-accent-ai-surface-hoverbg-accent-ai-surface-hover#dbcdfcalias di --label-violet-08#6f35f4A background tinted with the AI accent, hovered.
--magma-accent-ai-surface-subtlebg-accent-ai-surface-subtle#f0eafealias di --label-violet-10#3b09abA background tinted with the AI accent, lighter.
--magma-accent-ai-on-emphasistext-accent-ai-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on the solid fill of the AI accent.
Stati
Info, success, warning e danger pubblicano lo stesso vocabolario: wash con il loro testo, bordi, un riempimento pieno con il suo inchiostro, e tre scorciatoie alla prominenza predefinita (-surface, -fg, -border). Il ruolo danger usa la palette status-error. Un tema non ricolora mai uno stato; la preferenza di contrasto ne rafforza il testo.
Info
--magma-info-wash-softbg-info-wash-soft#dcf0faalias di --status-info-10#003f69The info background, the least marked.
--magma-info-wash-basebg-info-wash-base#c1e6f6alias di --status-info-09#005883The info background, at its default prominence.
--magma-info-wash-strongbg-info-wash-strong#a8dbf2alias di --status-info-08#006b97The info background, the most marked: icons only, no essential text.
--magma-info-text-defaulttext-info-fg-default#002d56alias di --text-info-default#e8f5fcInfo text on the info background.
--magma-info-text-mutedtext-info-fg-muted#004772alias di --text-info-muted#cfebf8Secondary info text on the info background.
--magma-info-text-subtletext-info-fg-subtle#005e89alias di --text-info-subtle#b4e0f4Non-essential info text on the info background.
--magma-info-text-disabledtext-info-fg-disabled#008ab8alias di --text-info-disabled#70c6eaDisabled info text on the info background.
--magma-info-border-mutedborder-info-border-muted#b8e2f5alias di --border-info-muted#004970The decorative info border.
--magma-info-border-defaultborder-info-border-default#8dcfebalias di --border-info-default#007ca8The functional info border.
--magma-info-border-strongborder-info-border-strong#129ac4alias di --border-info-strong#5eb8dcThe info border that conveys a state.
--magma-info-emphasisbg-info-emphasis#0077a4alias di --status-info-04#91d2efThe solid info fill: a solid badge, a button.
--magma-info-emphasis-hoverbg-info-emphasis-hover#005e89alias di --status-info-03#b4e0f4The solid info fill, hovered.
--magma-info-emphasis-activebg-info-emphasis-active#004772alias di --status-info-02#cfebf8The solid info fill, pressed.
--magma-info-on-emphasistext-info-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on the solid info fill.
--magma-info-surfacebg-info-surface#c1e6f6alias di --status-info-09#005883Shortcut for the info background at its default prominence (wash-base).
--magma-info-fgtext-info-fg#002d56alias di --text-info-default#e8f5fcShortcut for the default info text (text-default).
--magma-info-borderborder-info-border#8dcfebalias di --border-info-default#007ca8Shortcut for the functional info border (border-default).
Success
--magma-success-wash-softbg-success-wash-soft#dcf3e3alias di --status-success-10#004800The success background, the least marked.
--magma-success-wash-basebg-success-wash-base#bfe9cdalias di --status-success-09#00611bThe success background, at its default prominence.
--magma-success-wash-strongbg-success-wash-strong#a5e1baalias di --status-success-08#00742eThe success background, the most marked: icons only, no essential text.
--magma-success-text-defaulttext-success-fg-default#003500alias di --text-success-default#e7f7ecSuccess text on the success background.
--magma-success-text-mutedtext-success-fg-muted#005007alias di --text-success-muted#ceeed8Secondary success text on the success background.
--magma-success-text-subtletext-success-fg-subtle#006620alias di --text-success-subtle#b3e6c4Non-essential success text on the success background.
--magma-success-text-disabledtext-success-fg-disabled#00944calias di --text-success-disabled#6bce93Disabled success text on the success background.
--magma-success-border-mutedborder-success-border-muted#b9e8c9alias di --border-success-muted#005514The decorative success border.
--magma-success-border-defaultborder-success-border-default#8fd7a9alias di --border-success-default#008941The functional success border.
--magma-success-border-strongborder-success-border-strong#11a662alias di --border-success-strong#5fc388The success border that conveys a state.
--magma-success-emphasisbg-success-emphasis#008039alias di --status-success-04#8fd9aaThe solid success fill: a solid badge, a button.
--magma-success-emphasis-hoverbg-success-emphasis-hover#006620alias di --status-success-03#b3e6c4The solid success fill, hovered.
--magma-success-emphasis-activebg-success-emphasis-active#005007alias di --status-success-02#ceeed8The solid success fill, pressed.
--magma-success-on-emphasistext-success-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on the solid success fill.
--magma-success-surfacebg-success-surface#bfe9cdalias di --status-success-09#00611bShortcut for the success background at its default prominence (wash-base).
--magma-success-fgtext-success-fg#003500alias di --text-success-default#e7f7ecShortcut for the default success text (text-default).
--magma-success-borderborder-success-border#8fd7a9alias di --border-success-default#008941Shortcut for the functional success border (border-default).
Warning
--magma-warning-wash-softbg-warning-wash-soft#ffedb5alias di --status-warning-10#4f3b00The warning background, the least marked.
--magma-warning-wash-basebg-warning-wash-base#ffdc75alias di --status-warning-09#6b5000The warning background, at its default prominence.
--magma-warning-wash-strongbg-warning-wash-strong#ffcd39alias di --status-warning-08#816000The warning background, the most marked: icons only, no essential text.
--magma-warning-text-defaulttext-warning-fg-default#3a2c00alias di --text-warning-default#fff2cdWarning text on the warning background.
--magma-warning-text-mutedtext-warning-fg-muted#584200alias di --text-warning-muted#ffe595Secondary warning text on the warning background.
--magma-warning-text-subtletext-warning-fg-subtle#715500alias di --text-warning-subtle#ffd559Non-essential warning text on the warning background.
--magma-warning-text-disabledtext-warning-fg-disabled#a47b00alias di --text-warning-disabled#edb100Disabled warning text on the warning background.
--magma-warning-border-mutedborder-warning-border-muted#efd8a8alias di --border-warning-muted#653100The decorative warning border.
--magma-warning-border-defaultborder-warning-border-default#e2bf75alias di --border-warning-default#9b6200The functional warning border.
--magma-warning-border-strongborder-warning-border-strong#b88200alias di --border-warning-strong#d1a337The warning border that conveys a state.
--magma-warning-emphasisbg-warning-emphasis#8e6a00alias di --status-warning-04#febe00The solid warning fill: a solid badge, a button.
--magma-warning-emphasis-hoverbg-warning-emphasis-hover#715500alias di --status-warning-03#ffd559The solid warning fill, hovered.
--magma-warning-emphasis-activebg-warning-emphasis-active#584200alias di --status-warning-02#ffe595The solid warning fill, pressed.
--magma-warning-on-emphasistext-warning-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on the solid warning fill.
--magma-warning-surfacebg-warning-surface#ffdc75alias di --status-warning-09#6b5000Shortcut for the warning background at its default prominence (wash-base).
--magma-warning-fgtext-warning-fg#3a2c00alias di --text-warning-default#fff2cdShortcut for the default warning text (text-default).
--magma-warning-borderborder-warning-border#e2bf75alias di --border-warning-default#9b6200Shortcut for the functional warning border (border-default).
Danger
--magma-danger-wash-softbg-danger-wash-soft#ffe8e6alias di --status-error-10#770000The danger background, the least marked.
--magma-danger-wash-basebg-danger-wash-base#ffd6d3alias di --status-error-09#9e1823The danger background, at its default prominence.
--magma-danger-wash-strongbg-danger-wash-strong#fec6c2alias di --status-error-08#b63236The danger background, the most marked: icons only, no essential text.
--magma-danger-text-defaulttext-danger-fg-default#590000alias di --text-error-default#ffefeeDanger text on the danger background.
--magma-danger-text-mutedtext-danger-fg-muted#84000balias di --text-error-muted#ffdfddSecondary danger text on the danger background.
--magma-danger-text-subtletext-danger-fg-subtle#a52128alias di --text-error-subtle#ffcecaNon-essential danger text on the danger background.
--magma-danger-text-disabledtext-danger-fg-disabled#d95352alias di --text-error-disabled#faa5a0Disabled danger text on the danger background.
--magma-danger-border-mutedborder-danger-border-muted#ffcbc6alias di --border-error-muted#7e000fThe decorative danger border.
--magma-danger-border-defaultborder-danger-border-default#feaba5alias di --border-error-default#bc3a3cThe functional danger border.
--magma-danger-border-strongborder-danger-border-strong#da605dalias di --border-error-strong#f18883The danger border that conveys a state.
--magma-danger-emphasisbg-danger-emphasis#c44041alias di --status-error-04#fdb8b2The solid danger fill: a solid badge, a button.
--magma-danger-emphasis-hoverbg-danger-emphasis-hover#a52128alias di --status-error-03#ffcecaThe solid danger fill, hovered.
--magma-danger-emphasis-activebg-danger-emphasis-active#84000balias di --status-error-02#ffdfddThe solid danger fill, pressed.
--magma-danger-on-emphasistext-danger-on-emphasis#ffffffalias di --tone-neutral-seed#1d1d1dText and icons on the solid danger fill.
--magma-danger-surfacebg-danger-surface#ffd6d3alias di --status-error-09#9e1823Shortcut for the danger background at its default prominence (wash-base).
--magma-danger-fgtext-danger-fg#590000alias di --text-error-default#ffefeeShortcut for the default danger text (text-default).
--magma-danger-borderborder-danger-border#feaba5alias di --border-error-default#bc3a3cShortcut for the functional danger border (border-default).
Regole di abbinamento
-fg su una superficie neutra, -on-emphasis sul riempimento.Il testo su un wash ha dei limiti: wash-soft regge tutta la scala del testo, wash-base solo text-default, wash-strong solo icone. Vale lo stesso per ogni stato.Gerarchia senza perdere contrasto: usa peso, dimensione e spazi, e attenua la cornice (border-muted, righe alternate su surface-muted) invece del testo.L’elevazione è un ruolo: pagina surface-default, card surface-raised, livello galleggiante surface-overlay, pozzetto surface-sunken. Un grigio che deve risaltare in entrambe le modalità è un wash, non una superficie. Sono le coppie di cui Magma misura il contrasto; nessun’altra combinazione è misurata.
Palette
I primitivi a cui puntano i ruoli, da 01 a 10. Dipingi con essi solo quando il colore è un dato: una categoria, un’etichetta, un colore scelto dall’utente (label-*), un brand (brand-*). Le strisce seguono la modalità di questa pagina; un clic su un campione ne copia la custom property.
Toni
Le famiglie neutre. neutral è il grigio del tema predefinito; porcelain e bisque stanno dietro ai temi cool e warm: attivali con data-theme-name, non dipingere con essi a mano. seed è la carta della modalità, bianca in chiaro e nera in scuro.
porcelain
01020304050607080910seed
kaolin
01020304050607080910seed
neutral
01020304050607080910seed
fireclay
01020304050607080910seed
bisque
01020304050607080910seed
Colori di stato
--status-info#23b2e1
base01020304050607080910
--status-success#21bf73
base01020304050607080910
--status-error#ed6663
base01020304050607080910
--status-warning#ffc107
base01020304050607080910
Etichette
--label-red#d01b1b
base01020304050607080910
--label-amaranth#f43f5e
base01020304050607080910
--label-orchid#ec4899
base01020304050607080910
--label-purple#a855f7
base01020304050607080910
--label-violet#8b5cf6
base01020304050607080910
--label-blue#0e36f6
base01020304050607080910
--label-sky#0ea5e9
base01020304050607080910
--label-aqua#06b6d4
base01020304050607080910
--label-green#22c55e
base01020304050607080910
--label-lime#84cc16
base01020304050607080910
--label-yellow#eab308
base01020304050607080910
--label-orange#f97316
base01020304050607080910
Brand
--brand-maggioli#00379e
base01020304050607080910
--brand-maggioli-editore#0f4ad5
base01020304050607080910
--brand-rnd#cba26b
base01020304050607080910
Varianti
Alias delle famiglie che nominano, mantenuti per la prop variant dei componenti. Non hanno un ruolo proprio: gli accenti sono accent e accent-ai.
--variant-primaryalias di --brand-maggioli
base01020304050607080910
--variant-secondaryalias di --brand-maggioli-editore
base01020304050607080910
--variant-aialias di --label-violet
base01020304050607080910
Primitivi dei ruoli
I passi dietro ai ruoli neutri e di stato, un insieme per famiglia. Seguono la modalità ma non il tema né la preferenza di contrasto: dipingi con i ruoli --magma-*. --surface-<family>-sunken--surface-<family>-muted--surface-<family>-default--surface-<family>-raised--surface-<family>-overlay--border-<family>-muted--border-<family>-default--border-<family>-strong--text-<family>-default--text-<family>-muted--text-<family>-subtle--text-<family>-disabled
Modificato 6 giorni faVittorio VittoriDesign System Architect
Creato 6 giorni faVittorio VittoriDesign System Architect