@edusites/bancos-brasil 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core.js +14 -5
package/package.json
CHANGED
package/src/core.js
CHANGED
|
@@ -95,12 +95,21 @@ function extrairViewBox(svgCompleto) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function aplicarCor(conteudo, cor) {
|
|
98
|
-
// Aplica a cor
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
// Aplica a cor a todos os elementos gráficos
|
|
99
|
+
const elementos = ['path', 'circle', 'rect', 'polygon', 'ellipse', 'line', 'polyline']
|
|
100
|
+
let resultado = conteudo
|
|
101
|
+
|
|
102
|
+
elementos.forEach((elemento) => {
|
|
103
|
+
// Regex para encontrar cada elemento e seus atributos
|
|
104
|
+
const regex = new RegExp(`<${elemento}([^>]*)(\\/?>)`, 'g')
|
|
105
|
+
resultado = resultado.replace(regex, (match, attrs, fechamento) => {
|
|
106
|
+
// Remove fill existente e adiciona o novo
|
|
107
|
+
const attrsLimpos = attrs.replace(/\s*fill="[^"]*"/g, '')
|
|
108
|
+
return `<${elemento}${attrsLimpos} fill="${cor}"${fechamento}`
|
|
109
|
+
})
|
|
103
110
|
})
|
|
111
|
+
|
|
112
|
+
return resultado
|
|
104
113
|
}
|
|
105
114
|
|
|
106
115
|
export function svgBanco(options) {
|