-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to change nprogress bar color dynamically #187
Comments
i got it. thankyou |
Huh? what's the solution? |
Before starting NProgress.start(); function you need to change the color code in |
#nprogress .bar {
background: #29d !important;
} @bharathchandragoud Your style really helps. Thanks! |
Custom whole color by
|
Thanks for the answer @phattranky, but seems like the code for spinner has changed a little. It's now: #nprogress .spinner .spinner-icon { |
This is my style:
This way, you can even get to know more properties that you can customize. I hope it helps. |
|
Try this: NProgress.setColor("green");
NProgress.start();
// after dosomething...
NProgress.done(); src/utils/nprogress.ts import NProgress from "nprogress"; // progress bar
import "nprogress/nprogress.css"; // progress bar style
NProgress.configure({ showSpinner: false });
NProgress.setColor = (color) => {
const style = document.createElement('style')
style.textContent = `
#nprogress .bar {
background: ${color} !important;
}
`
document.body.appendChild(style)
}
export default NProgress; don't forget to declare it: import type { nProgress } from "nprogress"
declare module 'nprogress' {
interface NProgress extends nProgress {
setColor: (color: string) => void
[key: string]: any
}
} |
No description provided.
The text was updated successfully, but these errors were encountered: