@@ -112,9 +112,31 @@ the size of all your icons from a single place.
112112Icon Color
113113~~~~~~~~~~
114114
115- Typically, SVG icons use ``fill="currentColor" `` to inherit the color of the containing element.
116- You can set the color in CSS on the container or directly on the SVG element/class.
115+ UX Icons renders SVG icons with ``fill="currentColor" `` (see the `default configuration `_).
117116
117+ This means icons take their color from the CSS ``color `` property, which by default is inherited from the text color of
118+ the parent element.
119+
120+ .. code-block :: html+twig
121+
122+ <a href="#" class="text-blue-500">
123+ {# icon color: blue #}
124+ {{ ux_icon('bi:star') }}
125+ </a>
126+
127+ You can set the icon's color using CSS classes, either on the parent container or directly on the icon:
128+
129+ .. code-block :: html+twig
130+
131+ <div class="text-red-500">
132+ {# Inherit color from container (red) #}
133+ {{ ux_icon('warning') }}
134+
135+ {# Override parent with CSS class (blue) #}
136+ {{ ux_icon('warning', { class: 'text-blue-500' }) }}
137+ </div>
138+
139+ To configure a default class for all icons across your application see the `default configuration `_.
118140
119141Icon Sets
120142~~~~~~~~~
@@ -674,3 +696,4 @@ Learn more
674696.. _`Tabler Icons` : https://github.com/tabler/tabler-icons
675697.. _`Creating and Using Templates` : https://symfony.com/doc/current/templates.html
676698.. _`How to manage CSS and JavaScript assets in Symfony applications` : https://symfony.com/doc/current/frontend.html
699+ .. _`default configuration` : https://symfony.com/bundles/ux-icons/current/index.html#full-configuration
0 commit comments