File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,17 @@ export class SvgDrawController implements DrawController {
211211 ...options ,
212212 } ;
213213
214+ let finalTextColor = textOptions . textColor ;
215+ const lowerCaseTextColor = textOptions . textColor . toLowerCase ( ) ;
216+ if ( lowerCaseTextColor === '#fff' || lowerCaseTextColor === '#ffffff' || lowerCaseTextColor === 'white' ) {
217+ finalTextColor = '#000' ; // Change to black if current color is white
218+ }
219+ // No need to handle black to white, as SVG background is white.
220+ // Other colors will remain as they are.
221+
214222 this . svgStrings . push (
215- `<text x="${ canvasBasePoint . x } " y="${ canvasBasePoint . y } " fill="${ textOptions . textColor } " font-size="${ textOptions . fontSize } " font-family="${ textOptions . fontFamily } ">${ label } </text>`
223+ // Use finalTextColor here
224+ `<text x="${ canvasBasePoint . x } " y="${ canvasBasePoint . y } " fill="${ finalTextColor } " font-size="${ textOptions . fontSize } " font-family="${ textOptions . fontFamily } ">${ label } </text>`
216225 ) ;
217226 }
218227
You can’t perform that action at this time.
0 commit comments