@@ -22,6 +22,17 @@ export default function(context,data,options){
22
22
let foregroundColor = options . foregroundColor || '#000000' ;
23
23
let colors = foregroundColor . split ( ',' ) ;
24
24
let foregroundImage = colors [ 0 ] ;
25
+ let innerColor = options . innerColor || colors [ 0 ] ;
26
+ let outerColor = options . outerColor || colors [ 0 ] ;
27
+ if ( resources . backgroundImage ) {
28
+ foregroundColor = colors [ 0 ] . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
29
+ foregroundImage = foregroundColor ;
30
+ backgroundColor = backgroundColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
31
+ innerColor = innerColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
32
+ outerColor = outerColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
33
+ }
34
+ let innerImage = innerColor || foregroundImage ;
35
+ let outerImage = outerColor || foregroundImage ;
25
36
if ( ! options . foregroundColor && resources . foregroundImage ) {
26
37
foregroundImage = api . getImageBrush ( resources . foregroundImage ) ;
27
38
}
@@ -33,16 +44,6 @@ export default function(context,data,options){
33
44
} ) ;
34
45
foregroundImage = gradient ;
35
46
}
36
- let innerColor = options . innerColor || foregroundColor ;
37
- let outerColor = options . outerColor || foregroundColor ;
38
- if ( resources . backgroundImage ) {
39
- foregroundColor = foregroundColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
40
- backgroundColor = backgroundColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
41
- innerColor = innerColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
42
- outerColor = outerColor . replace ( / # ( [ 0 - 9 a - f A - F ] { 6 } ) .* / , '#$188' ) ;
43
- }
44
- let innerImage = innerColor || foregroundImage ;
45
- let outerImage = outerColor || foregroundImage ;
46
47
let backgroundImage = resources . backgroundImage ?api . getImageBrush ( resources . backgroundImage ) :backgroundColor ;
47
48
context . save ( ) ;
48
49
context . fillStyle = backgroundImage ;
@@ -67,7 +68,7 @@ export default function(context,data,options){
67
68
api . setRangeDisabled ( i , j , 7 , 7 ) ;
68
69
}
69
70
} else {
70
- let fillColor = api . getValue ( i , j ) == 1 ?foregroundColor :backgroundColor ;
71
+ let fillColor = api . getValue ( i , j ) == 1 ?foregroundImage :backgroundColor ;
71
72
context . fillStyle = fillColor ;
72
73
context . beginPath ( ) ;
73
74
context . arc ( i * pxWidth , j * pxWidth , 0.5 * pxWidth , 0 , 0.5 * Math . PI ) ;
0 commit comments