theme.ts 929 B

1234567891011121314151617181920212223242526272829303132
  1. import { EditorView } from '@codemirror/view'
  2. const fontFamily = 'Monaco, Menlo, Ubuntu Mono, Consolas, monospace'
  3. export const theme = () =>
  4. EditorView.theme({
  5. '&.cm-editor': {
  6. '--font-size': '12px',
  7. '--source-font-family': fontFamily,
  8. '--line-height': 1.6,
  9. },
  10. '.cm-content': {
  11. fontSize: 'var(--font-size)',
  12. fontFamily: 'var(--source-font-family)',
  13. lineHeight: 'var(--line-height)',
  14. color: '#000',
  15. },
  16. '.cm-gutters': {
  17. fontSize: 'var(--font-size)',
  18. lineHeight: 'var(--line-height)',
  19. },
  20. '.cm-tooltip': {
  21. // Set variables for tooltips, which are outside the editor
  22. '--font-size': '12px',
  23. '--source-font-family': fontFamily,
  24. // NOTE: fontFamily is not set here, as most tooltips use the UI font
  25. fontSize: 'var(--font-size)',
  26. },
  27. '.cm-lineNumbers': {
  28. fontFamily: 'var(--source-font-family)',
  29. },
  30. })