Print admin toolbar icon in custom module How can I print the admin toolbar icon for my module?

I created a module and it has a menu in the admin toolbar. I want to show an icon (module/costum_module/image/00/icon.svg) in this path for my admin toolbar tab.

I created a CSS style for that, but it doesn't work.

Module path :

/module/my module/css/styles.css   =>

.toolbar-icon-mymodule-list:before {
    background-image: url(../icons/787878/icon.svg);
}
.toolbar-icon-mymodule-list:active:before,
.toolbar-icon-mymodule-list.active:before {
    background-image: url(../icons/000000/icon.svg);
}


/module/my module/mymodule.libraries.yml   =>

mymodule.styles:
  css:
    theme:
      css/styles.css: {}
If you want to add svg icon for your menu link item in admin toolbar, you have to alter toolbart.

In your mymodule.libraries.yml file

toolbar:
  version: VERSION
  css:
   theme:
    css/styles.css: {}

And you need to implement hook_toolbar_alter() in your mymodul.module

function mymodule_toolbar_alter(&amp;$items) {
  $items['administration']['#attached']['library'][] = 'mymodule/toolbar';
}