@@ -83,6 +83,9 @@ define the HTML attributes added to the ``<svg>`` element:
83
83
{{ ux_icon('user-profile', {height: '16px', width: '16px', 'aria-hidden': true}) }}
84
84
{# renders <svg height="16" width="16" aria-hidden="true"> ... </svg> #}
85
85
86
+ Typically, icon SVG use `fill='currentColor' ` to inherit the color of the containing
87
+ element. You can use CSS to set the color either on the containing element or in a class
88
+ or style attribute of the icon itself.
86
89
87
90
Icon Sets
88
91
~~~~~~~~~
@@ -324,17 +327,17 @@ added to all icons unless overridden by the second argument of the ``ux_icon`` f
324
327
# config/packages/ux_icons.yaml
325
328
ux_icons :
326
329
default_icon_attributes :
327
- fill : currentColor
330
+ style : " color: white; "
328
331
329
- Now, all icons will have the ``fill `` attribute set to ``currentColor `` by default.
332
+ Now, all icons will have the ``style `` attribute set to ``color: white; `` by default.
330
333
331
334
.. code-block :: twig
332
335
333
- # renders "user-profile.svg" with fill="currentColor "
336
+ # renders "user-profile.svg" with style="color: white; "
334
337
{{ ux_icon('user-profile') }}
335
338
336
- # renders "user-profile.svg" with fill=" red"
337
- {{ ux_icon('user-profile', {fill : 'red'}) }}
339
+ # renders "user-profile.svg" with style="color: red"
340
+ {{ ux_icon('user-profile', {style : 'color: red; '}) }}
338
341
339
342
Icon Aliases
340
343
~~~~~~~~~~~~
@@ -546,7 +549,7 @@ Full Configuration
546
549
547
550
# Default attributes to add to all icons
548
551
default_icon_attributes :
549
- fill : currentColor
552
+ style : ' color: white; '
550
553
' font-size ' : ' 1.25em'
551
554
552
555
# Icon aliases (alias => icon name)
0 commit comments