Skip to content

Commit c1bbc58

Browse files
committed
Read colors from config, fallback to default config
1 parent 6ebf5e9 commit c1bbc58

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/styles.js

+21-21
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ module.exports = (theme) => ({
1313
DEFAULT: {
1414
css: [
1515
{
16-
color: defaultTheme.colors.gray[700],
16+
color: theme('colors.gray.700', defaultTheme.colors.gray[700]),
1717
maxWidth: '65ch',
1818
'[class~="lead"]': {
19-
color: defaultTheme.colors.gray[600],
19+
color: theme('colors.gray.600', defaultTheme.colors.gray[600]),
2020
},
2121
a: {
22-
color: defaultTheme.colors.gray[900],
22+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
2323
textDecoration: 'underline',
2424
fontWeight: '500',
2525
},
2626
strong: {
27-
color: defaultTheme.colors.gray[900],
27+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
2828
fontWeight: '600',
2929
},
3030
ol: {
@@ -38,27 +38,27 @@ module.exports = (theme) => ({
3838
content: 'counter(list-counter) "."',
3939
position: 'absolute',
4040
fontWeight: '400',
41-
color: defaultTheme.colors.gray[500],
41+
color: theme('colors.gray.500', defaultTheme.colors.gray[500]),
4242
},
4343
'ul > li': {
4444
position: 'relative',
4545
},
4646
'ul > li::before': {
4747
content: '""',
4848
position: 'absolute',
49-
backgroundColor: defaultTheme.colors.gray[300],
49+
backgroundColor: theme('colors.gray.300', defaultTheme.colors.gray[300]),
5050
borderRadius: '50%',
5151
},
5252
hr: {
53-
borderColor: defaultTheme.colors.gray[200],
53+
borderColor: theme('colors.gray.200', defaultTheme.colors.gray[200]),
5454
borderTopWidth: 1,
5555
},
5656
blockquote: {
5757
fontWeight: '500',
5858
fontStyle: 'italic',
59-
color: defaultTheme.colors.gray[900],
59+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
6060
borderLeftWidth: '0.25rem',
61-
borderLeftColor: defaultTheme.colors.gray[200],
61+
borderLeftColor: theme('colors.gray.200', defaultTheme.colors.gray[200]),
6262
quotes: '"\\201C""\\201D""\\2018""\\2019"',
6363
},
6464
'blockquote p:first-of-type::before': {
@@ -68,26 +68,26 @@ module.exports = (theme) => ({
6868
content: 'close-quote',
6969
},
7070
h1: {
71-
color: defaultTheme.colors.gray[900],
71+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
7272
fontWeight: '800',
7373
},
7474
h2: {
75-
color: defaultTheme.colors.gray[900],
75+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
7676
fontWeight: '700',
7777
},
7878
h3: {
79-
color: defaultTheme.colors.gray[900],
79+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
8080
fontWeight: '600',
8181
},
8282
h4: {
83-
color: defaultTheme.colors.gray[900],
83+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
8484
fontWeight: '600',
8585
},
8686
'figure figcaption': {
87-
color: defaultTheme.colors.gray[500],
87+
color: theme('colors.gray.500', defaultTheme.colors.gray[500]),
8888
},
8989
code: {
90-
color: defaultTheme.colors.gray[900],
90+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
9191
fontWeight: '600',
9292
},
9393
'code::before': {
@@ -97,11 +97,11 @@ module.exports = (theme) => ({
9797
content: '"`"',
9898
},
9999
'a code': {
100-
color: defaultTheme.colors.gray[900],
100+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
101101
},
102102
pre: {
103-
color: defaultTheme.colors.gray[200],
104-
backgroundColor: defaultTheme.colors.gray[800],
103+
color: theme('colors.gray.200', defaultTheme.colors.gray[200]),
104+
backgroundColor: theme('colors.gray.800', defaultTheme.colors.gray[800]),
105105
overflowX: 'auto',
106106
},
107107
'pre code': {
@@ -129,17 +129,17 @@ module.exports = (theme) => ({
129129
marginBottom: em(32, 16),
130130
},
131131
thead: {
132-
color: defaultTheme.colors.gray[900],
132+
color: theme('colors.gray.900', defaultTheme.colors.gray[900]),
133133
fontWeight: '600',
134134
borderBottomWidth: '1px',
135-
borderBottomColor: defaultTheme.colors.gray[300],
135+
borderBottomColor: theme('colors.gray.300', defaultTheme.colors.gray[300]),
136136
},
137137
'thead th': {
138138
verticalAlign: 'bottom',
139139
},
140140
'tbody tr': {
141141
borderBottomWidth: '1px',
142-
borderBottomColor: defaultTheme.colors.gray[200],
142+
borderBottomColor: theme('colors.gray.200', defaultTheme.colors.gray[200]),
143143
},
144144
'tbody tr:last-child': {
145145
borderBottomWidth: '0',

0 commit comments

Comments
 (0)