Reputation: 1694
I'm using OnsenUi framework for my webapp. and i need to know Is there any way to change the colour of toolbar based on the colour of the page. In other words, like Android 5 toolbar color effect.
If it possible, can you share me a snippet on how to do it?
If it's not, can you tell me where to change the color code manually, so that i can mimic that effect. What i found was, i can change the color of the toolbar in .navigation-bar
background color, but it makes the toolbar to display only one color in every page. Can anybody tell me where to modify to get different color for different pages?
Update #1
i tried a simple method
<ons-toolbar style="background-color:#B1797A;>
but this breaks my navigation !!
Any help would be appreciated. Thanks guys.
Upvotes: 0
Views: 1927
Reputation: 131
You could try this:
/lib/onsenui/css
from the root of your projectonsen-css-components.css
.toolbar--material
background-color
property of the class to a color of your choiceThis method worked for me.
Upvotes: 1
Reputation: 2667
In your document.ready
handler, get the background-color of the body
element and pass it to your toolbar, like so:
$(document).ready(function () {
var bgColor = $('body').css("background-color");
$('.navigation-bar').css("background-color", bgColor);
});
You can also see it happen when clicking on a button, in this demo:
Upvotes: 3