Skip to content

Commit b3b1d6d

Browse files
committed
feat: update code theme to green
1 parent 53272dd commit b3b1d6d

File tree

2 files changed

+65
-40
lines changed

2 files changed

+65
-40
lines changed

example/src/components/code.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,35 @@ const scope = {
3434

3535
const injectJsx = (src) => `/** @jsx jsx */\n${src}`
3636

37+
const liveTheme = { styles: [] }
38+
3739
export const LiveCode = ({ children }) => (
38-
<LiveProvider code={children} scope={scope} transformCode={injectJsx}>
39-
<BaseStyles>
40-
<div
40+
<LiveProvider
41+
code={children}
42+
scope={scope}
43+
transformCode={injectJsx}
44+
theme={liveTheme}
45+
>
46+
<div
47+
sx={{
48+
p: 2
49+
}}
50+
>
51+
<ThemeProvider theme={previewTheme}>
52+
<BaseStyles>
53+
<LivePreview />
54+
</BaseStyles>
55+
</ThemeProvider>
56+
<LiveError
4157
sx={{
42-
p: 2
58+
variant: 'alerts.danger',
59+
p: 3,
60+
mt: 4,
61+
mb: 2
4362
}}
44-
>
45-
<ThemeProvider theme={previewTheme}>
46-
<BaseStyles>
47-
<LivePreview />
48-
</BaseStyles>
49-
</ThemeProvider>
50-
<LiveError
51-
sx={{
52-
variant: 'alerts.danger',
53-
p: 3,
54-
mt: 4,
55-
mb: 2
56-
}}
57-
/>
58-
</div>
63+
/>
64+
</div>
65+
<BaseStyles>
5966
<pre
6067
sx={{
6168
my: 4

example/src/gatsby-plugin-theme-ui/theme.js

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -87,22 +87,13 @@ export const theme = {
8787
fontFamily: 'monospace',
8888
fontSize: 1,
8989
p: 3,
90-
color: 'text',
91-
bg: 'muted',
92-
overflow: 'auto',
93-
code: {
94-
color: 'inherit'
95-
}
90+
overflow: 'auto'
9691
},
9792
code: {
98-
fontFamily: 'monospace',
99-
color: 'secondary',
100-
fontSize: 1
93+
fontFamily: 'monospace'
10194
},
10295
inlineCode: {
103-
fontFamily: 'monospace',
104-
color: 'secondary',
105-
bg: 'muted'
96+
fontFamily: 'monospace'
10697
},
10798
table: {
10899
width: '100%',
@@ -135,21 +126,48 @@ export const theme = {
135126
maxWidth: '100%'
136127
}
137128
},
129+
// Prism theme based on https://github.com/PrismJS/prism-themes/blob/master/themes/prism-duotone-forest.css
138130
prism: {
139-
'.comment,.prolog,.doctype,.cdata,.punctuation,.operator,.entity,.url': {
140-
color: 'gray'
131+
backgroundColor: '#2a2d2a',
132+
color: '#90c392',
133+
'.comment,.prolog,.doctype,.cdata,.punctuation': {
134+
color: '#779077'
135+
},
136+
'.namespace': {
137+
opacity: 0.7
138+
},
139+
'.tag,.operator,.number': {
140+
color: '#d0c14e'
141+
},
142+
'.property,.function': {
143+
color: '#cebd8c'
144+
},
145+
'.tag-id,.selector,.atrule-id': {
146+
color: '#f0fff0'
147+
},
148+
'.attr-name': {
149+
color: '#b3d6b3'
150+
},
151+
'.boolean,.string,.entity,.url,.attr-value,.keyword,.control,.directive,.unit,.statement,.regex,.at-rule,.placeholder,.variable': {
152+
color: '#cee073'
153+
},
154+
'.deleted': {
155+
textDecorationLine: 'line-through'
156+
},
157+
'.inserted': {
158+
textDecorationLine: 'underline'
141159
},
142-
'.comment': {
160+
'.italic': {
143161
fontStyle: 'italic'
144162
},
145-
'.property,.tag,.boolean,.number,.constant,.symbol,.deleted,.function,.class-name,.regex,.important,.variable': {
146-
color: 'purple'
163+
'.important,.bold': {
164+
fontWeight: 'bold'
147165
},
148-
'.atrule,.attr-value,.keyword': {
149-
color: 'primary'
166+
'.important': {
167+
color: '#b3d6b3'
150168
},
151-
'.selector,.attr-name,.string,.char,.builtin,.inserted': {
152-
color: 'secondary'
169+
'.highlight': {
170+
background: '#435643'
153171
}
154172
}
155173
}

0 commit comments

Comments
 (0)