bradmartin / nativescript-snackbar

:lollipop: :chocolate_bar: NativeScript plugin for Material Design SnackBar
Apache License 2.0
73 stars 12 forks source link

Change background color? #18

Closed erjdriver closed 7 years ago

erjdriver commented 7 years ago

Can the background color be changed?

In my app - I use nativescript-themes to allow changing of themes and in the dark theme a different background color for the snackbar is desirable.

Thanks.

bradmartin commented 7 years ago

Yep it's possible. I haven't implemented it, will likely add later this week to the plugin.

This is what will be added and an option added to the snackbar options interface:

if (options.backgroundColor && Color.isValid(options.backgroundColor)) {
            let sbView = this._snackbar.getView();
            sbView.setBackgroundColor(options.backgroundColor.android);
 }

This might not be 100% accurate but it's something like that. Thanks for opening the issue, good option to provide 👍

erjdriver commented 7 years ago

Thanks Brad - that'll be a good addition and look forward to that addition.

bradmartin commented 7 years ago

Still haven't forgotten about this, just haven't been on mobile in a week. Maybe later this week I'll be back on mobile stuff and will make a quick update and publish the new version.

erjdriver commented 7 years ago

@Brad - while you're in the "looking process" - how about the ability to set a css-class.

or return the view and let user do something with that top-level view.

Maybe the implementation would not make it possible - but just a suggestion.

brad commented 7 years ago

¯\_(ツ)_/¯

davorpeic commented 7 years ago

@erjdriver Hi, you can now change background color (android only at this moment)

bradmartin commented 7 years ago

1.2.0 published to npm, thanks to @davorpeic 🎉