Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 71531

Unable to set ion-navbar colour dynamically

$
0
0

@danives wrote:

Hi,

I’m using a library (https://github.com/davidmerfield/randomColor) to generate a random colour per item in a list. When selecting that item in a list, I want the next page to open with the header having the same colour as the selected item.

However I’m finding that I can’t dynamically set the header background color at all. I’m trying:

<ion-navbar [style.background-color]="color">

…where color is a hex variable. However it remains grey. From what I can find online, it suggests that what I’m attempting to do is impossible, but I refuse to believe that the colour of the header can only be defined in the SASS code, and there must be a workaround - however I can’t seem to find said workaround.

Any help would be greatly appreciated, thank you in advance!

Dan

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 71531

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>