文字色
選択した文字に色名を適用します。保存される値は CSS の色文字列ではなく許可された名前で、実際の色は --nabi-tc-<name> CSS 変数で決めます。そのため、同じ文書でもライトテーマとダークテーマの両方で読みやすく調整できます。
ウィング
既定の書体高さ
HTMLエディタを読み込んでいます…
JSONnabi-treeエディタを読み込んでいます…
インストール
npm install nabi-noteコード
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: 'ja' })
const settle = watchSettle(document, { surface: content })
const shared = { nabi, registry, surface: content, settle, locale: 'ja' }
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()values を省略すると、基本パレットの green、coral、violet、amber、blue を使います。リストを減らすと、それ以外の色はコマンドでも読み込みでも受け付けません。
CSS スタイル
文書には色名だけが保存されます。エディターと公開画面の実際の色は CSS 変数で決めます。
css
.nabi-content { --nabi-tc-blue: #2563eb; }文字色は背景色と一緒に調整し、コントラストを確認してください。ダークテーマでは、同じ色名に別の値を与えられます。
css
.dark .article-body {
--nabi-tc-blue: #93c5fd;
--nabi-tc-green: #86efac;
}