react-terminal-themes/dist/ThemeComponents.js
autocommit 9e51dea529 chore: initial package split from monorepo
Package: @lilith/react-terminal-themes
Split from: lilith/ui.git or lilith/build.git
Publish workflow: calls lilith/workflows/.forgejo/workflows/publish-npm.yml@main
2026-04-20 01:10:36 -07:00

214 lines
No EOL
5.7 KiB
JavaScript

/**
* Reusable Theme Components
* Provides pre-configured components that can be mixed into themes
*/
// Window/Container presets
export const WindowPresets = {
clean: {
padding: 16,
borderRadius: 8,
shadow: '0 4px 16px rgba(0, 0, 0, 0.2)',
backgroundOpacity: 1,
terminalOpacity: 1,
backgroundMode: 'solid'
},
glassy: {
padding: 20,
borderRadius: 12,
shadow: '0 8px 32px rgba(0, 0, 0, 0.3)',
backgroundOpacity: 0.98,
terminalOpacity: 0.95,
backgroundMode: 'gradient'
},
immersive: {
padding: 20,
borderRadius: 4,
shadow: '0 0 40px rgba(0, 0, 0, 0.5)',
backgroundOpacity: 0.98,
terminalOpacity: 0.92,
backgroundMode: 'extend-effect'
},
retro: {
padding: 24,
borderRadius: 0,
shadow: 'none',
backgroundOpacity: 0.95,
terminalOpacity: 1,
backgroundMode: 'solid'
}
};
// Effect presets
export const EffectPresets = {
none: {
glow: { enabled: false, intensity: 0 },
scanlines: { enabled: false, opacity: 0 },
curvature: { enabled: false, amount: 0 },
chromaticAberration: { enabled: false, amount: 0 },
noise: { enabled: false, opacity: 0 }
},
subtle: {
glow: {
enabled: true,
intensity: 0.3
},
scanlines: { enabled: false, opacity: 0 },
curvature: { enabled: false, amount: 0 },
chromaticAberration: { enabled: false, amount: 0 },
noise: { enabled: false, opacity: 0 }
},
neon: {
glow: {
enabled: true,
intensity: 0.6
},
scanlines: { enabled: false, opacity: 0 },
curvature: { enabled: false, amount: 0 },
chromaticAberration: {
enabled: true,
amount: 0.002
},
noise: { enabled: false, opacity: 0 }
},
crt: {
glow: {
enabled: true,
intensity: 0.5
},
scanlines: {
enabled: true,
opacity: 0.05,
speed: 0.2
},
curvature: {
enabled: true,
amount: 0.02
},
chromaticAberration: { enabled: false, amount: 0 },
noise: { enabled: false, opacity: 0 }
},
phosphor: {
glow: {
enabled: true,
intensity: 0.8
},
scanlines: {
enabled: true,
opacity: 0.08,
speed: 0.1
},
curvature: {
enabled: true,
amount: 0.02
},
chromaticAberration: { enabled: false, amount: 0 },
noise: { enabled: false, opacity: 0 }
}
};
// Cursor presets
export const CursorPresets = {
standard: {
style: 'block',
blink: true,
blinkSpeed: 530
},
fast: {
style: 'block',
blink: true,
blinkSpeed: 350
},
underline: {
style: 'underline',
blink: true,
blinkSpeed: 400
},
bar: {
style: 'bar',
blink: true,
blinkSpeed: 450
}
};
// Font presets
export const FontPresets = {
modern: {
family: '"JetBrains Mono", "Fira Code", Consolas, Monaco, monospace',
size: 14,
weight: 400,
lineHeight: 1.5,
letterSpacing: 0.5,
ligatures: true
},
retro: {
family: '"IBM Plex Mono", "Courier New", Courier, monospace',
size: 13,
weight: 700,
lineHeight: 1.2,
letterSpacing: 1.5,
ligatures: false
},
compact: {
family: '"Source Code Pro", Consolas, monospace',
size: 12,
weight: 500,
lineHeight: 1.3,
letterSpacing: 0.3,
ligatures: true
}
};
// Scrollbar presets
export const ScrollbarPresets = {
minimal: {
width: 8,
trackColor: 'rgba(255, 255, 255, 0.05)',
thumbColor: 'rgba(255, 255, 255, 0.2)',
thumbHoverColor: 'rgba(255, 255, 255, 0.3)',
thumbActiveColor: 'rgba(255, 255, 255, 0.4)',
borderRadius: 8,
autoHide: true,
autoHideDelay: 1500
},
prominent: {
width: 12,
trackColor: 'rgba(255, 255, 255, 0.1)',
thumbColor: 'rgba(255, 255, 255, 0.3)',
thumbHoverColor: 'rgba(255, 255, 255, 0.5)',
thumbActiveColor: 'rgba(255, 255, 255, 0.7)',
borderRadius: 6,
autoHide: false,
autoHideDelay: 0
},
themed: {
width: 10,
trackColor: 'rgba(74, 144, 226, 0.2)',
thumbColor: 'rgba(74, 144, 226, 0.4)',
thumbHoverColor: 'rgba(74, 144, 226, 0.6)',
thumbActiveColor: 'rgba(74, 144, 226, 0.8)',
borderRadius: 10,
autoHide: true,
autoHideDelay: 2000
}
};
/**
* Helper to create a theme using components
*/
export function createTheme(name, colors, options) {
return {
name,
colors,
window: typeof options?.window === 'string'
? WindowPresets[options.window]
: options?.window || WindowPresets.clean,
effects: typeof options?.effects === 'string'
? EffectPresets[options.effects]
: options?.effects || EffectPresets.none,
cursor: typeof options?.cursor === 'string'
? CursorPresets[options.cursor]
: options?.cursor || CursorPresets.standard,
font: typeof options?.font === 'string'
? FontPresets[options.font]
: options?.font || FontPresets.modern,
scrollbar: typeof options?.scrollbar === 'string'
? ScrollbarPresets[options.scrollbar]
: options?.scrollbar || ScrollbarPresets.minimal
};
}
//# sourceMappingURL=ThemeComponents.js.map