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 {
514514 ? new THREE . Color ( style . color )
515515 : new THREE . Color ( COLOR_MAP [ style . color ] ) || color
516516 }
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+ }
518527
519528 const boldExtra = style . bold ? 1 : 0
520529
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ export type JsonTextObject = {
4444 text ?: string
4545 font ?: string
4646 color ?: JsonTextColor
47+ shadow_color ?: JsonTextColor
4748 extra ?: JsonTextArray
4849 bold ?: true | false
4950 italic ?: true | false
@@ -296,12 +297,17 @@ class JsonTextParser {
296297 case 'fallback' :
297298 obj [ key ] = this . parseString ( )
298299 break
299- case 'color' : {
300+ case 'color' :
301+ case 'shadow_color' : {
300302 const color = this . parseString ( ) as JsonTextColor
301303 if ( ! ( color . startsWith ( '#' ) || COLOR_MAP [ color ] ) ) {
302304 throw new ParserError ( `Unknown color '${ color } '` , this . s )
303305 }
304- obj . color = color
306+ if ( key === 'color' ) {
307+ obj . color = color
308+ } else {
309+ obj . shadow_color = color
310+ }
305311 break
306312 }
307313 case 'bold' :
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ const STYLE_KEYS = [
1919 'obfuscated' ,
2020 'color' ,
2121 'font' ,
22+ 'shadow_color' ,
2223] as const
2324
2425export type StyleRecord = Partial < Record < ( typeof STYLE_KEYS ) [ number ] , boolean | string > >
You can’t perform that action at this time.
0 commit comments