Change color of a lightning-vertical-navigation-item-icon

csslightninglightning-design-systemlightning-experiencelightning-web-components

I am building an lwc menu and have a

<lightning-vertical-navigation-item-icon
  label="Sessions"
  name="sessions"
  icon-name="utility:event"
  class="myIcon"
>
</lightning-vertical-navigation-item-icon>

But cant seem to change the color I think I tried everything with my CSS to override the default color but doesn't work

.slds-icon,
.slds-icon-text-default,
.slds-icon_x-small,
.my-icon,
lightning-primitive-icon,
.slds-nav-vertical__action {
  fill: #fff !important;
  color: #fff !important;
  background-color: #fff !important;
}

Best Answer

You could achieve this with styling hooks. In the chrome console you can see that for filling color is used this variable --sds-c-icon-color-foreground-default.

enter image description here

You can override this variable with any color you want, as follows.

yourComponent.css

:host {
    --sds-c-icon-color-foreground-default: green;
}