Skip to content

Commit 1823848

Browse files
committed
fix(convertColors): use currentColor instead of currentcolor
1 parent e645d71 commit 1823848

File tree

5 files changed

+15
-11
lines changed

5 files changed

+15
-11
lines changed

docs/04-plugins/convertColors.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ svgo:
55
defaultPlugin: true
66
parameters:
77
currentColor:
8-
description: If to convert all instances of a color to `currentcolor`. This means to inherit the active foreground color, for example in HTML5 this would be the [`color`](https://developer.mozilla.org/docs/Web/CSS/color) property in CSS.
8+
description: If to convert all instances of a color to `currentColor`. This means to inherit the active foreground color, for example in HTML5 this would be the [`color`](https://developer.mozilla.org/docs/Web/CSS/color) property in CSS.
99
default: false
1010
names2hex:
1111
description: If to convert color names to the hex equivalent.

docs/04-plugins/removeAttrs.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ svgo:
1010
description: The pattern syntax used by this plugin is `element:attribute:value`, this changes the delimiter from `:` to another string.
1111
default: ':'
1212
preserveCurrentColor:
13-
description: If to ignore the attribute when it's set to `currentcolor`.
13+
description: If to ignore the attribute when it's set to `currentColor`.
1414
default: false
1515
---
1616

plugins/convertColors.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export const fn = (_root, params) => {
107107
matched = val !== 'none';
108108
}
109109
if (matched) {
110-
val = 'currentcolor';
110+
val = 'currentColor';
111111
}
112112
}
113113

@@ -136,7 +136,11 @@ export const fn = (_root, params) => {
136136
}
137137
}
138138

139-
if (convertCase && !includesUrlReference(val)) {
139+
if (
140+
convertCase &&
141+
!includesUrlReference(val) &&
142+
val !== 'currentColor'
143+
) {
140144
if (convertCase === 'lower') {
141145
val = val.toLowerCase();
142146
} else if (convertCase === 'upper') {

test/plugins/convertColors.04.svg.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
@@@
1212

1313
<svg xmlns="http://www.w3.org/2000/svg">
14-
<g color="currentcolor"/>
15-
<g color="currentcolor"/>
14+
<g color="currentColor"/>
15+
<g color="currentColor"/>
1616
<g color="none"/>
17-
<path fill="currentcolor"/>
18-
<path fill="currentcolor"/>
19-
<path fill="currentcolor"/>
17+
<path fill="currentColor"/>
18+
<path fill="currentColor"/>
19+
<path fill="currentColor"/>
2020
<path fill="none"/>
2121
</svg>
2222

test/plugins/convertColors.06.svg.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Do not apply currentColor to masks.
2121
@@@
2222

2323
<svg xmlns="http://www.w3.org/2000/svg">
24-
<path fill="currentcolor"/>
24+
<path fill="currentColor"/>
2525
<mask id="mask1" fill="#fff"/>
2626
<mask id="mask2">
2727
<path fill="rgba(255,255,255,0.75)"/>
@@ -33,7 +33,7 @@ Do not apply currentColor to masks.
3333
</g>
3434
<mask id="inner-mask" fill="rgba(0,0,0,.5)"/>
3535
</mask>
36-
<path fill="currentcolor"/>
36+
<path fill="currentColor"/>
3737
</svg>
3838

3939
@@@

0 commit comments

Comments
 (0)