Skip to main content

Theming

All visual styling is driven by CSS custom properties (--notation-* tokens). Wrap your app in <ThemeProvider> to apply a theme, or override individual tokens with plain CSS.

ThemeProvider

import { ThemeProvider, defineTheme } from 'react-notation'
import 'react-notation/style.css'

const theme = defineTheme({
'color-chord': '#1a6cf5',
'font-size-chord': '1.125rem',
})

function App() {
return (
<ThemeProvider theme={theme}>
<ChordSheet score={score} />
</ThemeProvider>
)
}

ThemeProvider injects all --notation-* tokens as inline CSS variables onto a wrapper <div>. Unspecified tokens fall back to the library defaults. Nesting ThemeProvider components is supported — the innermost one wins.

defineTheme

function defineTheme(tokens: Partial<ThemeTokens>): Theme

Accepts a partial token map. Only the tokens you specify are overridden; all others use defaults.

CSS override (no ThemeProvider)

You can override tokens directly in your own stylesheet:

.my-song-section {
--notation-color-chord: #2563eb;
--notation-font-size-chord: 1.25rem;
}

Token reference

Typography

TokenDefaultDescription
--notation-font-familyGeorgia, "Times New Roman", serifBase font
--notation-font-size-base1remBase font size
--notation-font-size-chord1remChord symbol size
--notation-font-size-lyric0.9375remLyric text size
--notation-font-size-label0.75remSection/measure number labels
--notation-font-weight-chord600Chord symbol weight
--notation-font-weight-lyric400Lyric text weight

Color

TokenDefaultDescription
--notation-color-chordinheritChord symbol color
--notation-color-lyricinheritLyric text color
--notation-color-section-labelinheritSection/rehearsal mark color
--notation-color-measure-bordercurrentColorBar line color
--notation-color-backgroundtransparentComponent background

Spacing

TokenDefaultDescription
--notation-measure-gap1remGap between measures on a line
--notation-beat-gap0.5remGap between beat columns within a measure
--notation-line-gap1.5remVertical gap between lines
--notation-section-gap2remExtra top gap before section labels

Borders

TokenDefaultDescription
--notation-measure-border-width1pxBar line width
--notation-measure-border-stylesolidBar line style
--notation-measure-border-radius0Bar line border radius