Cor do texto
Aplique um nome de cor ao texto selecionado. O valor salvo não é uma string de cor CSS; é um nome permitido, e a cor real é definida pela variável CSS --nabi-tc-<name>. Assim o mesmo documento continua legível em temas claros e escuros.
Asas
Tipo de letra padrãoAltura
HTMLCarregando o editor…
JSONnabi-treeCarregando o editor…
Instalação
npm install nabi-noteCódigo
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: 'pt' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'pt' }
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 for omitido, a paleta padrão é green, coral, violet, amber e blue. Se você reduzir a lista, outras cores são rejeitadas por comandos e ao carregar documentos.
Estilos CSS
O documento guarda apenas nomes de cor. Defina as cores reais do editor e da vista publicada com variáveis CSS.
css
.nabi-content { --nabi-tc-blue: #2563eb; }Verifique o contraste junto com a cor de fundo. Em um tema escuro, o mesmo nome de cor pode receber outro valor.
css
.dark .article-body {
--nabi-tc-blue: #93c5fd;
--nabi-tc-green: #86efac;
}