@@ -7,6 +7,14 @@ const round = (num) =>
7
7
. replace ( / \. 0 $ / , '' )
8
8
const rem = ( px ) => `${ round ( px / 16 ) } rem`
9
9
const em = ( px , base ) => `${ round ( px / base ) } em`
10
+ const hexToRgb = ( hex ) => {
11
+ hex = hex . replace ( '#' , '' )
12
+ hex = hex . length === 3 ? hex . replace ( / ./ g, '$&$&' ) : hex
13
+ const r = parseInt ( hex . substring ( 0 , 2 ) , 16 )
14
+ const g = parseInt ( hex . substring ( 2 , 4 ) , 16 )
15
+ const b = parseInt ( hex . substring ( 4 , 6 ) , 16 )
16
+ return `${ r } ${ g } ${ b } `
17
+ }
10
18
11
19
let defaultModifiers = {
12
20
sm : {
@@ -68,6 +76,14 @@ let defaultModifiers = {
68
76
marginTop : em ( 24 , 14 ) ,
69
77
marginBottom : em ( 24 , 14 ) ,
70
78
} ,
79
+ kbd : {
80
+ fontSize : em ( 12 , 14 ) ,
81
+ borderRadius : rem ( 5 ) ,
82
+ paddingTop : em ( 2 , 14 ) ,
83
+ paddingRight : em ( 5 , 14 ) ,
84
+ paddingBottom : em ( 2 , 14 ) ,
85
+ paddingLeft : em ( 5 , 14 ) ,
86
+ } ,
71
87
code : {
72
88
fontSize : em ( 12 , 14 ) ,
73
89
} ,
@@ -254,6 +270,14 @@ let defaultModifiers = {
254
270
marginTop : em ( 32 , 16 ) ,
255
271
marginBottom : em ( 32 , 16 ) ,
256
272
} ,
273
+ kbd : {
274
+ fontSize : em ( 14 , 16 ) ,
275
+ borderRadius : rem ( 5 ) ,
276
+ paddingTop : em ( 3 , 16 ) ,
277
+ paddingRight : em ( 6 , 16 ) ,
278
+ paddingBottom : em ( 3 , 16 ) ,
279
+ paddingLeft : em ( 6 , 16 ) ,
280
+ } ,
257
281
code : {
258
282
fontSize : em ( 14 , 16 ) ,
259
283
} ,
@@ -440,6 +464,14 @@ let defaultModifiers = {
440
464
marginTop : em ( 32 , 18 ) ,
441
465
marginBottom : em ( 32 , 18 ) ,
442
466
} ,
467
+ kbd : {
468
+ fontSize : em ( 16 , 18 ) ,
469
+ borderRadius : rem ( 5 ) ,
470
+ paddingTop : em ( 4 , 18 ) ,
471
+ paddingRight : em ( 8 , 18 ) ,
472
+ paddingBottom : em ( 4 , 18 ) ,
473
+ paddingLeft : em ( 8 , 18 ) ,
474
+ } ,
443
475
code : {
444
476
fontSize : em ( 16 , 18 ) ,
445
477
} ,
@@ -626,6 +658,14 @@ let defaultModifiers = {
626
658
marginTop : em ( 40 , 20 ) ,
627
659
marginBottom : em ( 40 , 20 ) ,
628
660
} ,
661
+ kbd : {
662
+ fontSize : em ( 18 , 20 ) ,
663
+ borderRadius : rem ( 5 ) ,
664
+ paddingTop : em ( 5 , 20 ) ,
665
+ paddingRight : em ( 8 , 20 ) ,
666
+ paddingBottom : em ( 5 , 20 ) ,
667
+ paddingLeft : em ( 8 , 20 ) ,
668
+ } ,
629
669
code : {
630
670
fontSize : em ( 18 , 20 ) ,
631
671
} ,
@@ -812,6 +852,14 @@ let defaultModifiers = {
812
852
marginTop : em ( 48 , 24 ) ,
813
853
marginBottom : em ( 48 , 24 ) ,
814
854
} ,
855
+ kbd : {
856
+ fontSize : em ( 20 , 24 ) ,
857
+ borderRadius : rem ( 6 ) ,
858
+ paddingTop : em ( 6 , 24 ) ,
859
+ paddingRight : em ( 8 , 24 ) ,
860
+ paddingBottom : em ( 6 , 24 ) ,
861
+ paddingLeft : em ( 8 , 24 ) ,
862
+ } ,
815
863
code : {
816
864
fontSize : em ( 20 , 24 ) ,
817
865
} ,
@@ -955,6 +1003,8 @@ let defaultModifiers = {
955
1003
'--tw-prose-quotes' : colors . slate [ 900 ] ,
956
1004
'--tw-prose-quote-borders' : colors . slate [ 200 ] ,
957
1005
'--tw-prose-captions' : colors . slate [ 500 ] ,
1006
+ '--tw-prose-kbd' : colors . slate [ 900 ] ,
1007
+ '--tw-prose-kbd-shadows' : hexToRgb ( colors . slate [ 900 ] ) ,
958
1008
'--tw-prose-code' : colors . slate [ 900 ] ,
959
1009
'--tw-prose-pre-code' : colors . slate [ 200 ] ,
960
1010
'--tw-prose-pre-bg' : colors . slate [ 800 ] ,
@@ -971,6 +1021,8 @@ let defaultModifiers = {
971
1021
'--tw-prose-invert-quotes' : colors . slate [ 100 ] ,
972
1022
'--tw-prose-invert-quote-borders' : colors . slate [ 700 ] ,
973
1023
'--tw-prose-invert-captions' : colors . slate [ 400 ] ,
1024
+ '--tw-prose-invert-kbd' : colors . white ,
1025
+ '--tw-prose-invert-kbd-shadows' : hexToRgb ( colors . white ) ,
974
1026
'--tw-prose-invert-code' : colors . white ,
975
1027
'--tw-prose-invert-pre-code' : colors . slate [ 300 ] ,
976
1028
'--tw-prose-invert-pre-bg' : 'rgb(0 0 0 / 50%)' ,
@@ -992,6 +1044,8 @@ let defaultModifiers = {
992
1044
'--tw-prose-quotes' : colors . gray [ 900 ] ,
993
1045
'--tw-prose-quote-borders' : colors . gray [ 200 ] ,
994
1046
'--tw-prose-captions' : colors . gray [ 500 ] ,
1047
+ '--tw-prose-kbd' : colors . gray [ 900 ] ,
1048
+ '--tw-prose-kbd-shadows' : hexToRgb ( colors . gray [ 900 ] ) ,
995
1049
'--tw-prose-code' : colors . gray [ 900 ] ,
996
1050
'--tw-prose-pre-code' : colors . gray [ 200 ] ,
997
1051
'--tw-prose-pre-bg' : colors . gray [ 800 ] ,
@@ -1008,6 +1062,8 @@ let defaultModifiers = {
1008
1062
'--tw-prose-invert-quotes' : colors . gray [ 100 ] ,
1009
1063
'--tw-prose-invert-quote-borders' : colors . gray [ 700 ] ,
1010
1064
'--tw-prose-invert-captions' : colors . gray [ 400 ] ,
1065
+ '--tw-prose-invert-kbd' : colors . white ,
1066
+ '--tw-prose-invert-kbd-shadows' : hexToRgb ( colors . white ) ,
1011
1067
'--tw-prose-invert-code' : colors . white ,
1012
1068
'--tw-prose-invert-pre-code' : colors . gray [ 300 ] ,
1013
1069
'--tw-prose-invert-pre-bg' : 'rgb(0 0 0 / 50%)' ,
@@ -1029,6 +1085,8 @@ let defaultModifiers = {
1029
1085
'--tw-prose-quotes' : colors . zinc [ 900 ] ,
1030
1086
'--tw-prose-quote-borders' : colors . zinc [ 200 ] ,
1031
1087
'--tw-prose-captions' : colors . zinc [ 500 ] ,
1088
+ '--tw-prose-kbd' : colors . zinc [ 900 ] ,
1089
+ '--tw-prose-kbd-shadows' : hexToRgb ( colors . zinc [ 900 ] ) ,
1032
1090
'--tw-prose-code' : colors . zinc [ 900 ] ,
1033
1091
'--tw-prose-pre-code' : colors . zinc [ 200 ] ,
1034
1092
'--tw-prose-pre-bg' : colors . zinc [ 800 ] ,
@@ -1045,6 +1103,8 @@ let defaultModifiers = {
1045
1103
'--tw-prose-invert-quotes' : colors . zinc [ 100 ] ,
1046
1104
'--tw-prose-invert-quote-borders' : colors . zinc [ 700 ] ,
1047
1105
'--tw-prose-invert-captions' : colors . zinc [ 400 ] ,
1106
+ '--tw-prose-invert-kbd' : colors . white ,
1107
+ '--tw-prose-invert-kbd-shadows' : hexToRgb ( colors . white ) ,
1048
1108
'--tw-prose-invert-code' : colors . white ,
1049
1109
'--tw-prose-invert-pre-code' : colors . zinc [ 300 ] ,
1050
1110
'--tw-prose-invert-pre-bg' : 'rgb(0 0 0 / 50%)' ,
@@ -1066,6 +1126,8 @@ let defaultModifiers = {
1066
1126
'--tw-prose-quotes' : colors . neutral [ 900 ] ,
1067
1127
'--tw-prose-quote-borders' : colors . neutral [ 200 ] ,
1068
1128
'--tw-prose-captions' : colors . neutral [ 500 ] ,
1129
+ '--tw-prose-kbd' : colors . neutral [ 900 ] ,
1130
+ '--tw-prose-kbd-shadows' : hexToRgb ( colors . neutral [ 900 ] ) ,
1069
1131
'--tw-prose-code' : colors . neutral [ 900 ] ,
1070
1132
'--tw-prose-pre-code' : colors . neutral [ 200 ] ,
1071
1133
'--tw-prose-pre-bg' : colors . neutral [ 800 ] ,
@@ -1082,6 +1144,8 @@ let defaultModifiers = {
1082
1144
'--tw-prose-invert-quotes' : colors . neutral [ 100 ] ,
1083
1145
'--tw-prose-invert-quote-borders' : colors . neutral [ 700 ] ,
1084
1146
'--tw-prose-invert-captions' : colors . neutral [ 400 ] ,
1147
+ '--tw-prose-invert-kbd' : colors . white ,
1148
+ '--tw-prose-invert-kbd-shadows' : hexToRgb ( colors . white ) ,
1085
1149
'--tw-prose-invert-code' : colors . white ,
1086
1150
'--tw-prose-invert-pre-code' : colors . neutral [ 300 ] ,
1087
1151
'--tw-prose-invert-pre-bg' : 'rgb(0 0 0 / 50%)' ,
@@ -1103,6 +1167,8 @@ let defaultModifiers = {
1103
1167
'--tw-prose-quotes' : colors . stone [ 900 ] ,
1104
1168
'--tw-prose-quote-borders' : colors . stone [ 200 ] ,
1105
1169
'--tw-prose-captions' : colors . stone [ 500 ] ,
1170
+ '--tw-prose-kbd' : colors . stone [ 900 ] ,
1171
+ '--tw-prose-kbd-shadows' : hexToRgb ( colors . stone [ 900 ] ) ,
1106
1172
'--tw-prose-code' : colors . stone [ 900 ] ,
1107
1173
'--tw-prose-pre-code' : colors . stone [ 200 ] ,
1108
1174
'--tw-prose-pre-bg' : colors . stone [ 800 ] ,
@@ -1119,6 +1185,8 @@ let defaultModifiers = {
1119
1185
'--tw-prose-invert-quotes' : colors . stone [ 100 ] ,
1120
1186
'--tw-prose-invert-quote-borders' : colors . stone [ 700 ] ,
1121
1187
'--tw-prose-invert-captions' : colors . stone [ 400 ] ,
1188
+ '--tw-prose-invert-kbd' : colors . white ,
1189
+ '--tw-prose-invert-kbd-shadows' : hexToRgb ( colors . white ) ,
1122
1190
'--tw-prose-invert-code' : colors . white ,
1123
1191
'--tw-prose-invert-pre-code' : colors . stone [ 300 ] ,
1124
1192
'--tw-prose-invert-pre-bg' : 'rgb(0 0 0 / 50%)' ,
@@ -1262,6 +1330,8 @@ let defaultModifiers = {
1262
1330
'--tw-prose-quotes' : 'var(--tw-prose-invert-quotes)' ,
1263
1331
'--tw-prose-quote-borders' : 'var(--tw-prose-invert-quote-borders)' ,
1264
1332
'--tw-prose-captions' : 'var(--tw-prose-invert-captions)' ,
1333
+ '--tw-prose-kbd' : 'var(--tw-prose-invert-kbd)' ,
1334
+ '--tw-prose-kbd-shadows' : 'var(--tw-prose-invert-kbd-shadows)' ,
1265
1335
'--tw-prose-code' : 'var(--tw-prose-invert-code)' ,
1266
1336
'--tw-prose-pre-code' : 'var(--tw-prose-invert-pre-code)' ,
1267
1337
'--tw-prose-pre-bg' : 'var(--tw-prose-invert-pre-bg)' ,
@@ -1393,6 +1463,13 @@ module.exports = {
1393
1463
picture : {
1394
1464
display : 'block' ,
1395
1465
} ,
1466
+ kbd : {
1467
+ fontWeight : '500' ,
1468
+ fontFamily : 'inherit' ,
1469
+ color : 'var(--tw-prose-kbd)' ,
1470
+ boxShadow :
1471
+ '0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%), 0 3px 0 rgb(var(--tw-prose-kbd-shadows) / 10%)' ,
1472
+ } ,
1396
1473
code : {
1397
1474
color : 'var(--tw-prose-code)' ,
1398
1475
fontWeight : '600' ,
0 commit comments