question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ion-spinner style

See original GitHub issue

Issue

According to the ion-spinner api-doc you should be able to change the spinner color by changing stroke style via

ion-spinner svg {
  stroke: #444;
  fill: #222;
}

But this does not work, since stroke (and fill) is defined on classes of the form spinner-* (eg .spinner-ios, .spinner-dots, etc.) which take precedence over the above type selector.

Sidenote: The main use-case touched by this issue is changing the style/color of a single ion-spinner, not globally. Although spinners currently seem to use fixed color values in scss instead of variables, which would be another nice addition…

Tested with ionic2 beta9

Working solutions:

Using !important, which should be avoided as much as possible

ion-spinner svg * {
  stroke: #00f !important;
}

Overwriting all spinner- classes, which requires to have internal knowledge about ionic-angular

.spinner-ios line,
[...]
.spinner-crescent circle {
  stroke: #00f;
}

Desired solution:

Overwrite by attaching custom class to ion-spinner.

This does currently not seem to work, because <ion-spinner class="my-custom-blue"></ion-spinner> for example gets transformed into <ion-spinner _ngcontent-ykj-1="" class="spinner-crescent"></ion-spinner>, so any custom class gets dropped…

This seems like a severe bug to me. O_O

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
brandyscarneycommented, Aug 23, 2016

Thanks for the issue! This will be fixed in the beta 12 release. The class will no longer be clobbered, and you will be able to pass a color via the color input. See this file for some examples: https://github.com/driftyco/ionic/blob/master/src/components/spinner/test/colors/main.html

1reaction
sertal70commented, Dec 18, 2017

I would suggest you to update the online documentation at https://ionicframework.com/docs/api/components/spinner/Spinner/, because as per today it still reports that to change the spin color the fill and stroke properties must be used, no mention to the color property is made.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ion-spinner - Ionic Framework
The Spinner component provides a variety of animated SVG spinners. Spinners are visual indicators that the app is loading content or performing another...
Read more >
How to resize ion-spinner - css - Stack Overflow
I'm using ion-spinner in a ionic application. But im my case i want to change the size of the spinner. When i use...
Read more >
Ionic Spinner - javatpoint
The Ionic Spinner component provides several SVG spinners. The spinners are visual indicators that indicate the app is loading content or performing another ......
Read more >
ion-spinner style · Issue #7087 - GitHub
Sidenote: The main use-case touched by this issue is changing the style/color of a single ion-spinner, not globally.
Read more >
ion-spinner - Directive in module ionic
ion -spinner ... The ionSpinner directive provides a variety of animated spinners. Spinners enables you to give your users feedback that the app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found