sass-site/source/assets/js/playground/theme.ts

43 lines
1.3 KiB
TypeScript
Raw Normal View History

import { HighlightStyle } from '@codemirror/language';
import { tags } from '@lezer/highlight';
2023-06-02 16:53:32 +02:00
import { EditorView } from 'codemirror';
// TODO: Consider moving to vendor scss
const playgroundTheme = EditorView.baseTheme({
'&': {
height: '500px',
'font-size': 'var(--sl-font-size--x-small)',
2023-06-07 21:45:42 +02:00
'background-color': 'var(--sl-color-editor-background)',
color: 'var(--sl-color--code-text)',
2023-06-02 16:53:32 +02:00
},
'.cm-gutters': {
2023-06-07 21:45:42 +02:00
'background-color': 'var(--sl-color-editor-background)',
2023-06-02 16:53:32 +02:00
'border-right': 'none',
},
'.cm-content': {
2023-06-07 21:45:42 +02:00
// Todo - Pull from _typography?
'font-family':
2023-06-05 21:06:49 +02:00
"'Source Code Pro', 'SF Mono', monaco, inconsolata, 'Fira Mono', 'Droid Sans Mono', monospace;",
},
2023-06-02 16:53:32 +02:00
'.cm-scroller': {
overflow: 'auto',
},
2023-06-06 22:32:13 +02:00
'.cm-tooltip-lint': {
'font-family':
"'Source Code Pro', 'SF Mono', monaco, inconsolata, 'Fira Mono', 'Droid Sans Mono', monospace;",
},
2023-06-02 16:53:32 +02:00
});
const playgroundHighlightStyle = HighlightStyle.define([
{
tag: [tags.special(tags.variableName), tags.tagName],
color: '#445588',
fontWeight: 'bold',
},
{ tag: tags.definitionKeyword, fontWeight: 'bold' },
{ tag: tags.comment, color: '#006666', fontStyle: 'italic' },
{ tag: tags.propertyName, color: '#990000' },
]);
export { playgroundTheme, playgroundHighlightStyle };