File tree Expand file tree Collapse file tree 4 files changed +114
-52
lines changed Expand file tree Collapse file tree 4 files changed +114
-52
lines changed Original file line number Diff line number Diff line change @@ -514,7 +514,16 @@ export class MinecraftFont {
514
514
? new THREE . Color ( style . color )
515
515
: new THREE . Color ( COLOR_MAP [ style . color ] ) || color
516
516
}
517
- const shadowColor = color . clone ( ) . multiplyScalar ( 0.25 )
517
+
518
+ let shadowColor : THREE . Color
519
+ if ( typeof style . shadow_color === 'string' ) {
520
+ shadowColor =
521
+ style . shadow_color . startsWith ( '#' ) && style . shadow_color . length === 7
522
+ ? new THREE . Color ( style . shadow_color )
523
+ : new THREE . Color ( COLOR_MAP [ style . shadow_color ] ) || color
524
+ } else {
525
+ shadowColor = color . clone ( ) . multiplyScalar ( 0.25 )
526
+ }
518
527
519
528
const boldExtra = style . bold ? 1 : 0
520
529
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ export type JsonTextObject = {
44
44
text ?: string
45
45
font ?: string
46
46
color ?: JsonTextColor
47
+ shadow_color ?: JsonTextColor
47
48
extra ?: JsonTextArray
48
49
bold ?: true | false
49
50
italic ?: true | false
@@ -296,12 +297,17 @@ class JsonTextParser {
296
297
case 'fallback' :
297
298
obj [ key ] = this . parseString ( )
298
299
break
299
- case 'color' : {
300
+ case 'color' :
301
+ case 'shadow_color' : {
300
302
const color = this . parseString ( ) as JsonTextColor
301
303
if ( ! ( color . startsWith ( '#' ) || COLOR_MAP [ color ] ) ) {
302
304
throw new ParserError ( `Unknown color '${ color } '` , this . s )
303
305
}
304
- obj . color = color
306
+ if ( key === 'color' ) {
307
+ obj . color = color
308
+ } else {
309
+ obj . shadow_color = color
310
+ }
305
311
break
306
312
}
307
313
case 'bold' :
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const STYLE_KEYS = [
19
19
'obfuscated' ,
20
20
'color' ,
21
21
'font' ,
22
+ 'shadow_color' ,
22
23
] as const
23
24
24
25
export type StyleRecord = Partial < Record < ( typeof STYLE_KEYS ) [ number ] , boolean | string > >
You can’t perform that action at this time.
0 commit comments