Angular Material mat-spinner custom color

后端 未结 15 1542
慢半拍i
慢半拍i 2021-01-07 16:11

Does anyone know how can I change mat-spinner color in Angular Material? Overriding css doesn\'t work. I tried changing color in material files but they can only be imported

相关标签:
15条回答
  • 2021-01-07 17:09

    In your styles.css file, add...

    ::ng-deep .mat-progress-spinner circle, .mat-spinner circle {
        stroke: #2A79FF!important;
    }

    As you might have guessed, I have just made a simple modification to Nitin Wahale's answer. I have prefixed his answer with ::ng-deep and it worked in my case as I had the same issue.

    I hope this helps somebody

    0 讨论(0)
  • 2021-01-07 17:12

    In case you guys want to customize each spinner on your webpage. You can do it this way:

    svg .mat-progress-spinner circle, .mat-spinner circle {
      stroke: inherit;
    }
    

    And now on mat-spinner add class:

    <mat-spinner class="custom-spinner-color"></mat-spinner>
    

    And in css file:

    .custom-spinner-color {
      stroke: #234188;
    }
    

    That was what I wanted to achieve. I suppose if you look for this question you probably want the same.

    0 讨论(0)
  • 2021-01-07 17:16

    Use this code for ** < mat-spinner >** add this code in your .css file

    .mat-progress-spinner circle, .mat-spinner circle {
    stroke: #3fb53f;
    }
    
    0 讨论(0)
提交回复
热议问题