Skip to content

Commit b80083e

Browse files
Colin MackayColin Mackay
authored andcommitted
Fix up filled icons
1 parent f5eed8d commit b80083e

File tree

1,509 files changed

+1556
-1536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,509 files changed

+1556
-1536
lines changed

helpers/PhosphorIcons/StyleSvg.ps1

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,43 @@ foreach ($file in $svgFiles) {
4040
}
4141

4242
# All rect elements with an opacity attribute should get fill="currentColor"
43-
$pathElements = $svgXml.GetElementsByTagName("rect")
44-
foreach ($path in $pathElements) {
45-
if ($path.HasAttribute("opacity") -and -not $path.HasAttribute("fill")) {
46-
$path.SetAttribute("fill", "currentColor")
43+
$rectElements = $svgXml.GetElementsByTagName("rect")
44+
foreach ($rect in $rectElements) {
45+
if ($rect.HasAttribute("opacity") -and -not $rect.HasAttribute("fill")) {
46+
$rect.SetAttribute("fill", "currentColor")
4747
Write-Host "Added <rect ... fill=`"currentColor`"> in: $($file.FullName)"
4848
}
4949
}
5050

5151
# All polygon elements with an opacity attribute should get fill="currentColor"
52-
$pathElements = $svgXml.GetElementsByTagName("polygon")
53-
foreach ($path in $pathElements) {
54-
if ($path.HasAttribute("opacity") -and -not $path.HasAttribute("fill")) {
55-
$path.SetAttribute("fill", "currentColor")
52+
$polygonElements = $svgXml.GetElementsByTagName("polygon")
53+
foreach ($polygon in $polygonElements) {
54+
if ($polygon.HasAttribute("opacity") -and -not $polygon.HasAttribute("fill")) {
55+
$polygon.SetAttribute("fill", "currentColor")
5656
Write-Host "Added <polygon ... fill=`"currentColor`"> in: $($file.FullName)"
5757
}
5858
}
5959

60+
# For any file where the name ends with -fill.svg...
61+
if ($file.Name -like "*-fill.svg") {
62+
# ... ensure all path elements have fill="currentColor"
63+
$pathElements = $svgXml.GetElementsByTagName("path")
64+
foreach ($path in $pathElements) {
65+
if (-not $path.HasAttribute("fill")) {
66+
$path.SetAttribute("fill", "currentColor")
67+
Write-Host "Added <path ... fill=`"currentColor`"> in: $($file.FullName)"
68+
}
69+
}
70+
# ensure rect elements have fill="currentColor"
71+
$rectElements = $svgXml.GetElementsByTagName("rect")
72+
foreach ($rect in $rectElements) {
73+
if (-not $rect.HasAttribute("fill")) {
74+
$rect.SetAttribute("fill", "currentColor")
75+
Write-Host "Added <rect ... fill=`"currentColor`"> in: $($file.FullName)"
76+
}
77+
}
78+
}
79+
6080
$svgXml.Save($file.FullName)
6181
Write-Host "Updated file: $($file.FullName)"
6282
}
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)