Colore del testo
Applica al testo selezionato un nome di colore consentito. Il valore salvato non è una stringa colore CSS: è un nome consentito, e il colore reale è definito dalla variabile CSS --nabi-tc-<name>. Questo permette allo stesso documento di restare leggibile nei temi chiari e scuri.
Ali
Carattere di baseAltezza
HTMLCaricamento dell’editor…
JSONnabi-treeCaricamento dell’editor…
Installazione
npm install nabi-noteCodice
import {
createNabiWith, mountSurface, mountToolbar, mountContextToolbar,
mountHints, watchSettle, textColorWing, highlightWing, mountViewTools,
} from 'nabi-note'
const selected = [
textColorWing,
highlightWing,
]
const { nabi, registry } = createNabiWith(selected)
const root = document.querySelector('.nabi')!
const content = document.querySelector('.nabi-content')!
// The locale also sets the direction — Arabic and Urdu run right to left
mountSurface({ nabi, registry, root: content, locale: 'it' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'it' }
const toolbar = mountToolbar({ ...shared, root: document.querySelector('#toolbar')! })
const context = mountContextToolbar({ ...shared, root: document.querySelector('#context')! })
mountHints({ toolbar, context, root, surface: content })
// The preview and fullscreen buttons — they stand their own box at the end of the row
mountViewTools({ ...shared, root, container: document.querySelector('#toolbar')! })
// on every change — hook up your own code here
// nabi.onChange(() => user_callback(nabi.getHtml()))ts
const selected = wings().use('tc', {
values: ['green', 'coral', 'blue'],
}).build()Se values viene omesso, la palette predefinita è green, coral, violet, amber e blue. Se riduci la lista, gli altri colori vengono rifiutati dai comandi e durante il caricamento dei documenti.
Stili CSS
Il documento salva solo nomi di colore. Imposta i colori reali dell’editor e della vista pubblicata con variabili CSS.
css
.nabi-content { --nabi-tc-blue: #2563eb; }Controlla il contrasto insieme al colore di sfondo. In un tema scuro, lo stesso nome di colore può ricevere un valore diverso.
css
.dark .article-body {
--nabi-tc-blue: #93c5fd;
--nabi-tc-green: #86efac;
}