11import { isNumber } from './helpers/variableType' ;
22
3- const groupDecorations = line => {
3+ const groupDecorations = ( line , pdfDocument ) => {
44 let groups = [ ] ;
55 let currentGroup = null ;
66 for ( let i = 0 , l = line . inlines . length ; i < l ; i ++ ) {
@@ -13,7 +13,7 @@ const groupDecorations = line => {
1313 if ( ! Array . isArray ( decoration ) ) {
1414 decoration = [ decoration ] ;
1515 }
16- let color = inline . decorationColor || inline . color || 'black' ;
16+ let color = pdfDocument . resolveColor ( pdfDocument . resolveColor ( inline . decorationColor , inline . color ) , 'black' ) ;
1717 let style = inline . decorationStyle || 'solid' ;
1818 let thickness = isNumber ( inline . decorationThickness ) ? inline . decorationThickness : null ;
1919 for ( let ii = 0 , ll = decoration . length ; ii < ll ; ii ++ ) {
@@ -49,11 +49,12 @@ class TextDecorator {
4949 let height = line . getHeight ( ) ;
5050 for ( let i = 0 , l = line . inlines . length ; i < l ; i ++ ) {
5151 let inline = line . inlines [ i ] ;
52- if ( ! inline . background ) {
52+
53+ let color = this . pdfDocument . resolveColor ( inline . background , undefined ) ;
54+ if ( ! color ) {
5355 continue ;
5456 }
5557
56- let color = inline . background ;
5758 let patternColor = this . pdfDocument . providePattern ( inline . background ) ;
5859 if ( patternColor !== null ) {
5960 color = patternColor ;
@@ -67,7 +68,7 @@ class TextDecorator {
6768 }
6869
6970 drawDecorations ( line , x , y ) {
70- let groups = groupDecorations ( line ) ;
71+ let groups = groupDecorations ( line , this . pdfDocument ) ;
7172 for ( let i = 0 , l = groups . length ; i < l ; i ++ ) {
7273 this . _drawDecoration ( groups [ i ] , x , y ) ;
7374 }
0 commit comments