cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamically change the label widget font color

SOLVED
CZ_9645217
Aquamarine

How to dynamically change the label widget font color

Hi there,

 

I have a requirement, the color of the font needs to be determined according to the result of the conditional judgment, for example, the background set a goal, when the value > goal, the font is red, whether the label widget can achieve this requirement, or other widgets can achieve it, thank you very much.

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to dynamically change the labe widget font color

Hi @CZ_9645217,

 

Below configurations for your reference:

1. Create a thing with an infotable type property which named theme(persistent), and add two values (like A_Theme and B_Theme)
2. Create two themes with different font color, the theme names are the same as the infotable property values defined in the first step(A_Theme and B_Theme)

4. Create a service, when value > goal, the output is A_Theme, while value <=goal, the output is B_Theme

5. Bind service output with label Style Theme in the mashup

6. Create a subscription, when goal value changes, executing the service.

 

Thanks,

/Yoyo

View solution in original post

5 REPLIES 5

Re: How to dynamically change the labe widget font color

Hi @CZ_9645217,

 

Below configurations for your reference:

1. Create a thing with an infotable type property which named theme(persistent), and add two values (like A_Theme and B_Theme)
2. Create two themes with different font color, the theme names are the same as the infotable property values defined in the first step(A_Theme and B_Theme)

4. Create a service, when value > goal, the output is A_Theme, while value <=goal, the output is B_Theme

5. Bind service output with label Style Theme in the mashup

6. Create a subscription, when goal value changes, executing the service.

 

Thanks,

/Yoyo

View solution in original post

Re: How to dynamically change the labe widget font color

@yhan Got it, a very good solution, it solved a big confusion for me. thank you very much for your quick reply.

Re: How to dynamically change the labe widget font color

hi yhan,

 

Because the theme is applied to the entire mashup, if a mashup has two labels, there is no way to deal with this; are there other solution, thank you!

Re: How to dynamically change the labe widget font color

Actually, it is the problem that the style theme will be applied to the top-level mashup, so it would be also applied to all embedded widgets if you check the "Use Theme" option from the widget's container properties.

To a single themeable widget:

1. Uncheck the "UseTheme" option from the widget's container properties

        5-19-2021 10-30-44 AM.jpg

2. Set Style Properties manually by using the method mentioned in previous reply.

 

 

Tags (1)

Re: How to dynamically change the labe widget font color

I used custom css resolved the issue. thank you!

 

.redFont .widget-content{color: #FF0000 !important;}

Announcements

Check out the upcoming Expert Session: Understanding ThingWorx Navigate Licensing in Community "Customer Events" section.