overleaf-cep/services/web/frontend/js/shared/utils/styles.ts
Mathias Jakobsen 39b4581e1d Merge pull request #26735 from overleaf/mj-system-theme
[web] Add new system theme to the editor

GitOrigin-RevId: b65083c5e96abc493556e901c861689cb7e3bbf7
2025-07-14 08:05:37 +00:00

29 lines
744 B
TypeScript

export type OverallTheme = '' | 'light-' | 'system'
export const fontFamilies = {
monaco: ['Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'monospace'],
lucida: ['Lucida Console', 'Source Code Pro', 'monospace'],
opendyslexicmono: ['OpenDyslexic Mono', 'monospace'],
}
export type FontFamily = keyof typeof fontFamilies
export const lineHeights = {
compact: 1.33,
normal: 1.6,
wide: 2,
}
export type LineHeight = keyof typeof lineHeights
type Options = {
fontFamily: FontFamily
fontSize: number
lineHeight: LineHeight
}
export const userStyles = ({ fontFamily, fontSize, lineHeight }: Options) => ({
fontFamily: fontFamilies[fontFamily]?.join(','),
fontSize: `${fontSize}px`,
lineHeight: lineHeights[lineHeight],
})