Create a shared module for CSS styles from user settings (#22925)

GitOrigin-RevId: 1e62258e1e38d8ab2ce8debc51c53a98f4e915f6
This commit is contained in:
Alf Eaton
2025-01-20 09:04:57 +00:00
committed by Copybot
parent fdf7a34f8f
commit ce1d63d92c
9 changed files with 59 additions and 60 deletions
@@ -0,0 +1,29 @@
export type OverallTheme = '' | 'light-'
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],
})