react-terminal-ui/dist/core/themeAdapter.js
autocommit 1ce3936ff0 chore: initial package split from monorepo
Package: @lilith/react-terminal-ui
Split from: lilith/ui.git or lilith/build.git
Publish workflow: calls lilith/workflows/.forgejo/workflows/publish-npm.yml@main
2026-04-20 01:11:11 -07:00

50 lines
No EOL
1.9 KiB
JavaScript

export function applyThemeToTerminal(terminal, theme) {
if (!terminal || !theme)
return;
// Apply color theme
terminal.options.theme = {
background: theme.colors.background,
foreground: theme.colors.foreground,
cursor: theme.colors.cursor,
cursorAccent: theme.colors.cursorAccent,
selectionBackground: theme.colors.selection,
selectionForeground: theme.colors.foreground,
black: theme.colors.black,
red: theme.colors.red,
green: theme.colors.green,
yellow: theme.colors.yellow,
blue: theme.colors.blue,
magenta: theme.colors.magenta,
cyan: theme.colors.cyan,
white: theme.colors.white,
brightBlack: theme.colors.brightBlack,
brightRed: theme.colors.brightRed,
brightGreen: theme.colors.brightGreen,
brightYellow: theme.colors.brightYellow,
brightBlue: theme.colors.brightBlue,
brightMagenta: theme.colors.brightMagenta,
brightCyan: theme.colors.brightCyan,
brightWhite: theme.colors.brightWhite
};
// Apply font settings
if (theme.font) {
if (theme.font.family)
terminal.options.fontFamily = theme.font.family;
if (theme.font.size)
terminal.options.fontSize = theme.font.size;
if (theme.font.weight)
terminal.options.fontWeight = theme.font.weight;
if (theme.font.letterSpacing !== undefined)
terminal.options.letterSpacing = theme.font.letterSpacing;
if (theme.font.lineHeight !== undefined)
terminal.options.lineHeight = theme.font.lineHeight;
}
// Apply cursor settings
if (theme.cursor) {
if (theme.cursor.style)
terminal.options.cursorStyle = theme.cursor.style;
if (theme.cursor.blink !== undefined)
terminal.options.cursorBlink = theme.cursor.blink;
}
}
//# sourceMappingURL=themeAdapter.js.map