如何更改 ngb-tabset type="pills" 的颜色?

Lyn*_*nob 5 ng-bootstrap angular angular6

我正在使用 angular 6 和 ng-bootstrap。我想改变背景颜色<ngb-tabset type="pills">

.nav-fill .nav-link.active {
    margin-top: -1px;
    border-top: 2px solid #20a8d8;
}

.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
    color: #fff;
    background-color: #20a8d8;
}
Run Code Online (Sandbox Code Playgroud)

component.scss即使我使用!important这些是内联样式,我也无法覆盖它们。我不知道它们位于何处,搜索了整个项目都找不到它们。

Con*_*Fan 7

由于药丸位于子组件 ( NgbTabset ) 中,因此您必须使用阴影穿透后代组合器来应用样式。目前,Angular 推荐使用::ng-deep

::ng-deep .nav-fill .nav-link.active {
    margin-top: -1px;
    border-top: 2px solid #20a8d8;
}

::ng-deep .nav-pills .nav-link.active, 
::ng-deep .nav-pills .show > .nav-link {
    color: #fff;
    background-color: #20a8d8;
}
Run Code Online (Sandbox Code Playgroud)

有关演示,请参阅此 stackblitz