|
|
|
@ -2,7 +2,7 @@ import { HighlightStyle } from '@codemirror/language'; |
|
|
|
|
import { EditorView } from 'codemirror'; |
|
|
|
|
import { tags as t } from '@lezer/highlight'; |
|
|
|
|
|
|
|
|
|
export const editorDarkTheme = EditorView.theme( |
|
|
|
|
export const editorLightTheme = EditorView.theme( |
|
|
|
|
{ |
|
|
|
|
// Styling for the editor background and text
|
|
|
|
|
'&': {}, |
|
|
|
@ -14,43 +14,41 @@ export const editorDarkTheme = EditorView.theme( |
|
|
|
|
'.cm-content': {}, |
|
|
|
|
// Line number styles
|
|
|
|
|
'.cm-lineNumbers .cm-gutterElement': { |
|
|
|
|
color: '#757575', |
|
|
|
|
color: '#6b7280', |
|
|
|
|
minWidth: '24px', |
|
|
|
|
}, |
|
|
|
|
// Scrollbar styles
|
|
|
|
|
'.cm-scroller': { |
|
|
|
|
paddingRight: '12px', |
|
|
|
|
paddingLeft: '12px', |
|
|
|
|
}, |
|
|
|
|
'.cm-scroller::-webkit-scrollbar': {}, |
|
|
|
|
// Highlight active line
|
|
|
|
|
'.cm-activeLine': { |
|
|
|
|
backgroundColor: '#27272a', |
|
|
|
|
backgroundColor: '#f3f4f6', |
|
|
|
|
}, |
|
|
|
|
// Cursor styles
|
|
|
|
|
'.cm-cursor': { |
|
|
|
|
borderColor: '#f4f4f5', |
|
|
|
|
borderColor: '#18181b', |
|
|
|
|
}, |
|
|
|
|
// Code line styling for inserted and deleted lines
|
|
|
|
|
'.code-line.inserted': { |
|
|
|
|
backgroundColor: 'rgba(72, 187, 120, 0.2)', // Green background for inserted lines
|
|
|
|
|
backgroundColor: 'rgba(72, 187, 120, 0.1)', // Lighter green background for inserted lines
|
|
|
|
|
}, |
|
|
|
|
'.code-line.deleted': { |
|
|
|
|
backgroundColor: 'rgba(239, 68, 68, 0.1)', // Red background for deleted lines
|
|
|
|
|
backgroundColor: 'rgba(239, 68, 68, 0.05)', // Lighter red background for deleted lines
|
|
|
|
|
}, |
|
|
|
|
// Highlighted line
|
|
|
|
|
'.highlight-line': { |
|
|
|
|
borderLeft: '2px solid #EC4899', // Pink border for highlighted line
|
|
|
|
|
backgroundColor: 'rgba(229, 231, 235, 0.4)', // Light gray background for highlighted lines
|
|
|
|
|
borderLeft: '2px solid #EC4899', // Keep pink border for highlighted line
|
|
|
|
|
backgroundColor: 'rgba(243, 244, 246, 0.6)', // Very light gray background for highlighted lines
|
|
|
|
|
}, |
|
|
|
|
'.cm-gutters': { |
|
|
|
|
backgroundColor: '#18181b', |
|
|
|
|
backgroundColor: '#f9fafb', |
|
|
|
|
}, |
|
|
|
|
'.cm-activeLineGutter': { |
|
|
|
|
backgroundColor: '#27272a', |
|
|
|
|
backgroundColor: '#f3f4f6', |
|
|
|
|
}, |
|
|
|
|
'.cm-line': { |
|
|
|
|
color: '#a1a1aa', |
|
|
|
|
color: '#374151', |
|
|
|
|
}, |
|
|
|
|
'.cm-foldPlaceholder': { |
|
|
|
|
border: 'none', |
|
|
|
@ -61,20 +59,20 @@ export const editorDarkTheme = EditorView.theme( |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
{ |
|
|
|
|
dark: true, |
|
|
|
|
dark: false, |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
export const editorDarkHightlightStyle = HighlightStyle.define([ |
|
|
|
|
{ tag: t.keyword, color: '#3B82F6' }, |
|
|
|
|
{ tag: t.operator, color: '#F59E0B' }, |
|
|
|
|
{ tag: t.variableName, color: '#D946EF' }, |
|
|
|
|
{ tag: t.number, color: '#10B981' }, |
|
|
|
|
{ tag: t.string, color: '#A855F7' }, |
|
|
|
|
{ tag: t.punctuation, color: '#a1a1aa' }, |
|
|
|
|
{ tag: t.typeName, color: '#D946EF' }, |
|
|
|
|
{ tag: t.attributeName, color: '#A855F7' }, |
|
|
|
|
{ tag: t.name, color: '#f4f4f5' }, |
|
|
|
|
{ tag: t.comment, color: '#71717a' }, |
|
|
|
|
{ tag: t.paren, color: '#a1a1aa' }, |
|
|
|
|
export const editorLightHightlightStyle = HighlightStyle.define([ |
|
|
|
|
{ tag: t.keyword, color: '#2563eb' }, // Slightly darker blue
|
|
|
|
|
{ tag: t.operator, color: '#d97706' }, // Slightly darker amber
|
|
|
|
|
{ tag: t.variableName, color: '#c026d3' }, // Slightly darker fuchsia
|
|
|
|
|
{ tag: t.number, color: '#059669' }, // Slightly darker emerald
|
|
|
|
|
{ tag: t.string, color: '#7c3aed' }, // Slightly darker violet
|
|
|
|
|
{ tag: t.punctuation, color: '#6b7280' }, // Gray-500
|
|
|
|
|
{ tag: t.typeName, color: '#c026d3' }, // Slightly darker fuchsia
|
|
|
|
|
{ tag: t.attributeName, color: '#7c3aed' }, // Slightly darker violet
|
|
|
|
|
{ tag: t.name, color: '#18181b' }, // Dark gray for better contrast
|
|
|
|
|
{ tag: t.comment, color: '#9ca3af' }, // Gray-400
|
|
|
|
|
{ tag: t.paren, color: '#6b7280' }, // Gray-500
|
|
|
|
|
]); |
|
|
|
|