Skip to content

Commit

Permalink
Fix logo
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcconechy committed Sep 21, 2023
1 parent bce9b67 commit 5853d30
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scripts/node/build-icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,22 @@ function optimizeSVGs(src) {
const isLogo = filepath.indexOf(`logo-`) > 1;
const isClassic = filepath.indexOf(`theme-classic`) > 1;

if (hasStroke && !isEmpty) {
if (hasStroke && !isEmpty && !isLogo) {
if (!isClassic) svgFile = svgFile.replace(`xmlns="http://www.w3.org/2000/svg"`, `xmlns="http://www.w3.org/2000/svg" style="color: #28282A; fill: transparent"`);
svgFile = svgFile.replaceAll('stroke="currentColor"', 'stroke="currentColor" fill="transparent"');
} else if (!isEmpty && !isClassic) {
} else if (!isEmpty && !isClassic && !isLogo) {
svgFile = svgFile.replace(`xmlns="http://www.w3.org/2000/svg"`, `xmlns="http://www.w3.org/2000/svg" style="color: transparent; fill: #28282A;"`);
}

let pathStatement = svgFile
.replace(/<svg[^>]*>/g, '')
.replace(/<\/svg>/g, '');
pathStatement = pathStatement.replaceAll('#000', 'currentColor');

if (isLogo) {
pathStatement = pathStatement.replaceAll('#000', 'currentColor');
}
const hasStroke2 = pathStatement.indexOf('stroke="currentColor"') > -1;
if (!hasStroke2 && !isEmpty) pathStatement = pathStatement.replace('d=', 'fill="currentColor" stroke="none" d=');
if (!hasStroke2 && !isEmpty && !isLogo) pathStatement = pathStatement.replace('d=', 'fill="currentColor" stroke="none" d=');

if (pathStatement.indexOf('stroke="currentColor"') === -1 && !isEmpty && !isLogo) {
pathStatement = pathStatement.replaceAll('fill-rule="evenodd"', 'fill="currentColor" fill-rule="evenodd" stroke="none"');
Expand Down

0 comments on commit 5853d30

Please sign in to comment.