styles.ts 744 B

1234567891011121314151617181920212223242526272829
  1. export type OverallTheme = '' | 'light-' | 'system'
  2. export const fontFamilies = {
  3. monaco: ['Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'monospace'],
  4. lucida: ['Lucida Console', 'Source Code Pro', 'monospace'],
  5. opendyslexicmono: ['OpenDyslexic Mono', 'monospace'],
  6. }
  7. export type FontFamily = keyof typeof fontFamilies
  8. export const lineHeights = {
  9. compact: 1.33,
  10. normal: 1.6,
  11. wide: 2,
  12. }
  13. export type LineHeight = keyof typeof lineHeights
  14. type Options = {
  15. fontFamily: FontFamily
  16. fontSize: number
  17. lineHeight: LineHeight
  18. }
  19. export const userStyles = ({ fontFamily, fontSize, lineHeight }: Options) => ({
  20. fontFamily: fontFamilies[fontFamily]?.join(','),
  21. fontSize: `${fontSize}px`,
  22. lineHeight: lineHeights[lineHeight],
  23. })