Search code examples
angularmarquee

ng-marquee change background-color


No matter I tried the following codes, the background-color still not works. Is there any way to change it?

The package I installed: https://developer.aliyun.com/mirror/npm/package/ng-marquee/v/1.0.1

<ng-marquee [stopOnHover]="true" duration="40s" direction="alternate" bgcolor="#212529" > Test </ng-marquee>

or

Component:

<ng-marquee [stopOnHover]="true" duration="40s" direction="alternate" class="Color"> Test </ng-marquee>

CSS:

.Color { background-color: #212529; }

Solution

  • Thanks to @JBoothUA reply. ::ng-deep is the solve

    Component:

    <ng-marquee [stopOnHover]="true" duration="40s" direction="alternate" class="marquee">
        Test
    </ng-marquee>
    

    CSS:

    .marquee { 
        ::ng-deep {
            .ng-marquee {
                background-color: #292059; 
                color: white;
            }
        }
    }