@@ -20,6 +20,45 @@ import { useMutation, useQueryClient } from '@tanstack/react-query';
20
20
import { useTheme } from 'next-themes' ;
21
21
import { toast } from 'react-hot-toast' ;
22
22
import { Icon } from './shared/icon' ;
23
+ import createTheme from '@uiw/codemirror-themes' ;
24
+ import { tags as t } from '@lezer/highlight' ;
25
+
26
+ const myTheme = createTheme ( {
27
+ theme : 'dark' ,
28
+ settings : {
29
+ background : '#151718' ,
30
+ foreground : '#c9d1d9' ,
31
+ caret : '#c9d1d9' ,
32
+ selection : '#003d73' ,
33
+ selectionMatch : '#003d73' ,
34
+ lineHighlight : '#36334280' ,
35
+
36
+ gutterBackground : 'transparent' ,
37
+ gutterForeground : 'rgb(155, 161, 166,0.6)' ,
38
+ } ,
39
+ styles : [
40
+ { tag : [ t . standard ( t . tagName ) , t . tagName ] , color : '#7ee787' } ,
41
+ { tag : [ t . comment , t . bracket ] , color : '#8b949e' } ,
42
+ { tag : [ t . className , t . propertyName ] , color : '#d2a8ff' } ,
43
+ {
44
+ tag : [ t . variableName , t . attributeName , t . number , t . operator ] ,
45
+ color : '#79c0ff' ,
46
+ } ,
47
+ {
48
+ tag : [ t . keyword , t . typeName , t . typeOperator , t . typeName ] ,
49
+ color : '#ff7b72' ,
50
+ } ,
51
+ { tag : [ t . string , t . meta , t . regexp ] , color : '#a5d6ff' } ,
52
+ { tag : [ t . name , t . quote ] , color : '#7ee787' } ,
53
+ { tag : [ t . heading ] , color : '#d2a8ff' , fontWeight : 'bold' } ,
54
+ { tag : [ t . emphasis ] , color : '#d2a8ff' , fontStyle : 'italic' } ,
55
+ { tag : [ t . deleted ] , color : '#ffdcd7' , backgroundColor : 'ffeef0' } ,
56
+ { tag : [ t . atom , t . bool , t . special ( t . variableName ) ] , color : '#ffab70' } ,
57
+ { tag : t . link , textDecoration : 'underline' } ,
58
+ { tag : t . strikethrough , textDecoration : 'line-through' } ,
59
+ { tag : t . invalid , color : '#f97583' } ,
60
+ ] ,
61
+ } ) ;
23
62
24
63
export const Editor = ( ) => {
25
64
const { resolvedTheme } = useTheme ( ) ;
@@ -59,7 +98,7 @@ export const Editor = () => {
59
98
return (
60
99
< >
61
100
< CodeMirror
62
- theme = { resolvedTheme === 'dark' ? githubDark : githubLight }
101
+ theme = { resolvedTheme === 'dark' ? myTheme : githubLight }
63
102
value = { query }
64
103
basicSetup = { {
65
104
defaultKeymap : false ,
0 commit comments