forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (22 loc) · 852 Bytes
/
index.js
File metadata and controls
25 lines (22 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import dot from 'dot-object';
import applicationTheme from '@codesandbox/common/lib/theme';
import codesandboxBlack from '@codesandbox/common/lib/themes/codesandbox-black';
import codesandboxLight from '@codesandbox/common/lib/themes/codesandbox-light.json';
import tokens from './tokens';
export function getTheme(variant) {
const embedTheme = variant === 'light' ? codesandboxLight : codesandboxBlack;
// merge vscode colors into tokens
Object.assign(tokens.colors, dot.object({ ...embedTheme.colors }));
return {
// hope to remove this bit
...applicationTheme,
// used for parts imported from outside embed
...embedTheme.colors,
// used for syntax highlighting
vscodeTheme: embedTheme,
// used for embed styles
...tokens,
// used by multiple components in common
light: variant === 'light',
};
}