site
site

Reputation: 247

Change color text using Label

How to change text color on menu bar when using Label Nativescript.

My code:

        <StackLayout row="1" orientation="horizontal" backgroundColor="#eae8e8" class="foot">
            <Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
                <FormattedString>
                    <Span text="Photos"></Span>
                </FormattedString>
            </Label>
   <Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
                <FormattedString>
                    <Span text="Albums"></Span>
                </FormattedString>
            </Label>
         </StackLayout>

I want like this image When click

Upvotes: 0

Views: 593

Answers (1)

bhavin jalodara
bhavin jalodara

Reputation: 1530

you can use color attribute both in CSS and direct HTML to specify the color to the element. for example:

zontal" backgroundColor="#eae8e8" class="foot">
            <Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
                <FormattedString>
                    <Span color="blue" text="Photos"></Span>
                </FormattedString>
            </Label>
   <Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
                <FormattedString>
                    <Span text="Albums"></Span>
                </FormattedString>
            </Label>
         </StackLayout>

here is playground demo:https://play.nativescript.org/?template=play-ng&id=gMhuwo&v=2

Upvotes: 1

Related Questions