Skip to content

Commit 5b0bdc5

Browse files
committed
feat: add monokai theme.
1 parent 10ff7ec commit 5b0bdc5

File tree

6 files changed

+70
-1
lines changed

6 files changed

+70
-1
lines changed

core/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ import { githubLightTheme } from '@uiw/react-json-view/githubLight';
9090
import { githubDarkTheme } from '@uiw/react-json-view/githubDark';
9191
import { vscodeTheme } from '@uiw/react-json-view/vscode';
9292
import { gruvboxTheme } from '@uiw/react-json-view/gruvbox';
93+
import { monokaiTheme } from '@uiw/react-json-view/monokai';
9394

9495
const object = {
9596
string: 'Lorem ipsum dolor sit amet',
@@ -113,6 +114,7 @@ export default function Demo() {
113114
<JsonView value={object} style={githubDarkTheme} />
114115
<JsonView value={object} style={gruvboxTheme} />
115116
<JsonView value={object} style={vscodeTheme} />
117+
<JsonView value={object} style={monokaiTheme} />
116118
</div>
117119
);
118120
}

core/monokai.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
declare module '@uiw/react-json-view/monokai' {
2+
export const monokaiTheme: import('react').CSSProperties;
3+
}

core/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
"types": "./cjs/theme/vscode.d.ts",
3838
"require": "./cjs/theme/vscode.js"
3939
},
40+
"./monokai": {
41+
"import": "./esm/theme/monokai.js",
42+
"types": "./cjs/theme/monokai.d.ts",
43+
"require": "./cjs/theme/monokai.js"
44+
},
4045
"./gruvbox": {
4146
"import": "./esm/theme/gruvbox.js",
4247
"types": "./cjs/theme/gruvbox.d.ts",

core/src/theme/monokai.test.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { monokaiTheme } from './monokai';
2+
3+
it('monokaiTheme test case', () => {
4+
expect(monokaiTheme).toHaveProperty('--w-rjv-font-family', 'monospace');
5+
expect(Object.keys(monokaiTheme)).toMatchObject([
6+
'--w-rjv-font-family',
7+
'--w-rjv-color',
8+
'--w-rjv-background-color',
9+
'--w-rjv-line-color',
10+
'--w-rjv-arrow-color',
11+
'--w-rjv-edit-color',
12+
'--w-rjv-info-color',
13+
'--w-rjv-update-color',
14+
'--w-rjv-copied-color',
15+
'--w-rjv-copied-success-color',
16+
'--w-rjv-curlybraces-color',
17+
'--w-rjv-colon-color',
18+
'--w-rjv-brackets-color',
19+
'--w-rjv-type-string-color',
20+
'--w-rjv-type-int-color',
21+
'--w-rjv-type-float-color',
22+
'--w-rjv-type-bigint-color',
23+
'--w-rjv-type-boolean-color',
24+
'--w-rjv-type-date-color',
25+
'--w-rjv-type-url-color',
26+
'--w-rjv-type-null-color',
27+
'--w-rjv-type-nan-color',
28+
'--w-rjv-type-undefined-color',
29+
]);
30+
});

core/src/theme/monokai.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const monokaiTheme = {
2+
'--w-rjv-font-family': 'monospace',
3+
'--w-rjv-color': '#E6DB74',
4+
'--w-rjv-background-color': '#272822',
5+
'--w-rjv-line-color': '#3e3d32',
6+
'--w-rjv-arrow-color': '#f8f8f2',
7+
'--w-rjv-edit-color': 'var(--w-rjv-color)',
8+
'--w-rjv-info-color': '#cecece4d',
9+
'--w-rjv-update-color': '#5f5600',
10+
'--w-rjv-copied-color': '#E6DB74',
11+
'--w-rjv-copied-success-color': '#28a745',
12+
13+
'--w-rjv-curlybraces-color': '#f8f8f2',
14+
'--w-rjv-colon-color': '#f8f8f2',
15+
'--w-rjv-brackets-color': '#f8f8f2',
16+
17+
'--w-rjv-type-string-color': '#E6DB74',
18+
'--w-rjv-type-int-color': '#AE81FF',
19+
'--w-rjv-type-float-color': '#AE81FF',
20+
'--w-rjv-type-bigint-color': '#AE81FF',
21+
'--w-rjv-type-boolean-color': '#AE81FF',
22+
'--w-rjv-type-date-color': '#fd9720c7',
23+
'--w-rjv-type-url-color': '#0969da',
24+
'--w-rjv-type-null-color': '#FA2672',
25+
'--w-rjv-type-nan-color': '#FD971F',
26+
'--w-rjv-type-undefined-color': '#FD971F',
27+
} as React.CSSProperties;

www/src/example/default.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ import { githubLightTheme } from '@uiw/react-json-view/githubLight';
88
import { githubDarkTheme } from '@uiw/react-json-view/githubDark';
99
import { vscodeTheme } from '@uiw/react-json-view/vscode';
1010
import { gruvboxTheme } from '@uiw/react-json-view/gruvbox';
11+
import { monokaiTheme } from '@uiw/react-json-view/monokai';
1112

1213
export const themesData = {
13-
gruvbox: gruvboxTheme,
1414
light: lightTheme,
1515
dark: darkTheme,
1616
nord: nordTheme,
1717
vscode: vscodeTheme,
1818
githubLight: githubLightTheme,
1919
githubDark: githubDarkTheme,
20+
gruvbox: gruvboxTheme,
21+
monokai: monokaiTheme,
2022
};
2123

2224
const avatar = 'https://i.imgur.com/1bX5QH6.jpg';

0 commit comments

Comments
 (0)