2023-03-24 09:59:13 -04:00
|
|
|
import { EditorView } from '@codemirror/view'
|
|
|
|
|
2023-05-04 05:57:24 -04:00
|
|
|
const fontFamily = 'Monaco, Menlo, Ubuntu Mono, Consolas, monospace'
|
2023-03-24 09:59:13 -04:00
|
|
|
|
2023-05-04 05:57:24 -04:00
|
|
|
export const theme = () =>
|
|
|
|
EditorView.theme({
|
|
|
|
'&.cm-editor': {
|
|
|
|
'--font-size': '12px',
|
|
|
|
'--source-font-family': fontFamily,
|
|
|
|
'--line-height': 1.6,
|
|
|
|
},
|
|
|
|
'.cm-content': {
|
|
|
|
fontSize: 'var(--font-size)',
|
|
|
|
fontFamily: 'var(--source-font-family)',
|
|
|
|
lineHeight: 'var(--line-height)',
|
|
|
|
color: '#000',
|
|
|
|
},
|
|
|
|
'.cm-gutters': {
|
|
|
|
fontSize: 'var(--font-size)',
|
|
|
|
lineHeight: 'var(--line-height)',
|
|
|
|
},
|
|
|
|
'.cm-tooltip': {
|
|
|
|
// Set variables for tooltips, which are outside the editor
|
|
|
|
'--font-size': '12px',
|
|
|
|
'--source-font-family': fontFamily,
|
|
|
|
// NOTE: fontFamily is not set here, as most tooltips use the UI font
|
|
|
|
fontSize: 'var(--font-size)',
|
|
|
|
},
|
|
|
|
'.cm-lineNumbers': {
|
|
|
|
fontFamily: 'var(--source-font-family)',
|
|
|
|
},
|
|
|
|
})
|