• Administrator
  •  
    Support Ukraine
    If you experience any problems with the forum (it is not visible, there is no way to post messages, or some functionality does not work), please let us know. If you have problems with registration or you did not receive confirmation letter, let us know and we will activate your account manually.
    If you get an "The submitted form was invalid. Try submitting again" error, delete cookies, then try again.
     

Dynamically changing font color

A branch of the forum to discuss everything that is connected with Huami Zepp OS.

Moderators: asoo, Watchmens

Forum rules
All communication in this branch should only be in English.
Post Reply
toolsrme
Posts: 19
Joined: 04 Aug 2023, 18:36
Location: Missouri
Has thanked: 9 times
Contact:

Dynamically changing font color

Post by toolsrme »

Does anyone know a way to dynamically change a font color for a hmUI.widget.TEXT or hmUI.widget.TEXT_FONT object through something like a touch of the screen.

I've been able to do it hmUI.widget.TEXT if it the type value isn't set. So I was able to do it with code like this:

Code: Select all

            temp_text = hmUI.createWidget(hmUI.widget.TEXT, {
              x: 184,
              y: 158,
              w: 202,
              h: 50,
              text_size: 40,
              char_space: 0,
              line_space: 0,
              color: 0xFF24AAE2,
              align_h: hmUI.align.LEFT,
              align_v: hmUI.align.TOP,
              show_level: hmUI.show_level.ONLY_NORMAL,
            });
But not with code like this:

Code: Select all

            temp_text = hmUI.createWidget(hmUI.widget.TEXT, {
              x: 184,
              y: 158,
              w: 202,
              h: 50,
              text_size: 40,
              char_space: 0,
              line_space: 0,
              color: 0xFF24AAE2,
              align_h: hmUI.align.LEFT,
              align_v: hmUI.align.TOP,
              type: hmUI.data_type.WEATHER_CURRENT,
              show_level: hmUI.show_level.ONLY_NORMAL,
            });
Somehow adding in the "type" property I lose control over stuff like the color.

The problem is that I haven't been able to access all the sensor data to get information all all the stuff I want to change the color of. Current temp, altimeter, altitude, uvi, calorie, pai, wind, step, heart, etc...

While I have the javascript that changes the color property for the text object, it just never updates the display.
Post Reply

Return to “Zepp OS”

Who is online

Users browsing this forum: No registered users and 1 guest