Skip to content

Commit

Permalink
use xcode theme for light and add more coloring
Browse files Browse the repository at this point in the history
  • Loading branch information
czgu committed Nov 19, 2024
1 parent 70e1c6e commit 46fa5c4
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 12 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@types/diff": "^5.0.2",
"@uiw/codemirror-extensions-events": "^4.23.6",
"@uiw/codemirror-theme-monokai": "^4.23.6",
"@uiw/codemirror-theme-xcode": "^4.23.6",
"@uiw/codemirror-themes": "^4.23.5",
"@uiw/react-codemirror": "^4.23.5",
"@welldone-software/why-did-you-render": "^6.1.1",
Expand Down
8 changes: 6 additions & 2 deletions querybook/webapp/components/QueryEditor/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { TableToken } from 'lib/sql-helper/sql-lexer';
import { navigateWithinEnv } from 'lib/utils/query-string';
import { IconButton } from 'ui/Button/IconButton';

import { CustomMonokaiDarkTheme } from './monokai';
import { CustomMonokaiDarkTheme, CustomXcodeTheme } from './themes';

import './QueryEditor.scss';

Expand Down Expand Up @@ -436,7 +436,11 @@ export const QueryEditor: React.FC<
{floatButtons}
<CodeMirror
ref={editorRef}
theme={theme === 'dark' ? CustomMonokaiDarkTheme : 'light'}
theme={
theme === 'dark'
? CustomMonokaiDarkTheme
: CustomXcodeTheme
}
className="ReactCodeMirror"
value={value}
height="100%"
Expand Down
7 changes: 0 additions & 7 deletions querybook/webapp/components/QueryEditor/monokai.ts

This file was deleted.

22 changes: 22 additions & 0 deletions querybook/webapp/components/QueryEditor/themes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { monokaiInit } from '@uiw/codemirror-theme-monokai';
import { tags as t } from '@lezer/highlight';
import { xcodeLightInit } from '@uiw/codemirror-theme-xcode';

export const CustomMonokaiDarkTheme = monokaiInit({
settings: {},
styles: [
{ tag: [t.name], color: 'var(--text-dark)' },
{ tag: [t.constant(t.name), t.standard(t.name)], color: '#FD971F' },
],
});

export const CustomXcodeTheme = xcodeLightInit({
settings: {
background: 'var(--bg-color)',
gutterBackground: 'var(--bg-color)',
},
styles: [
{ tag: [t.special(t.propertyName)], color: '#327A9E' },
{ tag: [t.constant(t.name), t.standard(t.name)], color: '#D23423' },
],
});
Loading

0 comments on commit 46fa5c4

Please sign in to comment.