lobianco ha scritto: 23 set 2025, 22:52
Hi, @asoo
In the example above, the battery cycle is changing color, as you taught me, but I've run into another problem: changing the color of the battery text element. I've tried everything, but I can't. I looked for a watchface that changes the color of the battery value, but I couldn't find it. Could you help me, if possible?
normal_battery_circle_scale.setProperty(hmUI.prop.MORE, {
color: colorss,
radius: 27,
line_width: 16
});
normal_battery_current_text_font.setProperty(hmUI.prop.COLOR, colorss);
normal_day_text_font.setProperty(hmUI.prop.COLOR, colorss);
normal_battery_current_text_font = hmUI.createWidget(hmUI.widget.TEXT_FONT, {
x: 133,
y: 70,
w: 150,
h: 30,
text_size: 18,
char_space: 0,
font: 'fonts/Panton-Bold.ttf',
color: colorss,
line_space: 0,
align_v: hmUI.align.CENTER_V,
text_style: hmUI.text_style.ELLIPSIS,
align_h: hmUI.align.CENTER_H,
type: hmUI.data_type.BATTERY,
show_level: hmUI.show_level.ONLY_NORMAL,
});
**hmUI.createWidget(hmUI.widget.TEXT_FONT, {
normal_day_text_font = hmUI.createWidget(hmUI.widget.TEXT, {
x: 133,
y: 320,
w: 150,
h: 30,
text_size: 26,
char_space: 0,
font: 'fonts/Panton-Bold.ttf',
color: colorss, //inicial cor cinza
line_space: 0,
align_v: hmUI.align.CENTER_V,
text_style: hmUI.text_style.ELLIPSIS,
align_h: hmUI.align.CENTER_H,
// padding: true,
show_level: hmUI.show_level.ONLY_NORMAL,
});
**hmUI.createWidget.TEXT, {...
normal battery current text_font - does not work
normal_day_text_font - works
Thank you very much in advance.
I think some of the scripts in the attached file might be corrupted.
I can't unpack it properly, and I'm busy right now. So, I do not like to check your index.js for errors.
I'll rebuild it from the old file I created and add some your script
The problem you mentioned, that you can't change the battery text color, might be due to the widget's property change style.
I recommend that if you've tried to chang properties with ".setProperty( xxxx)" and it doesn't work, try using ".setProperty(hmUI.prop.MORE" to change the property. It's the most effective change I've tested. I recommend typing in all the widget data for when use the ".setProperty(hmUI.prop.MORE" change, because some widgets, even if you use "MORE," if you not put complete information may not work.
From your "user_functions.js", I modified it as follows:
Codice: Seleziona tutto
// start user_functions.js
let totalcolors_main = 7; // 7
let colornumber_main = 0; // actual color: 0..6
let colorss = 0xFFC9C9C9;
// Cores Tabs
let colors = [
0xFFC9C9C9, // 0 -> cinza claro (initial)
0xFFFFCC00, // 1 -> amarelo
0xFF479135, // 2 -> verde
0xFFFFB3BA, // 3 -> rosa claro
0xFF5D6DD1, // 4 -> azul
0xFFFF9224, // 5 -> laranja
0xFFFF0000 // 6 -> vermelho
];
function click_Color() {
// alterna cor (volta pra 1 se passar do total)
colornumber_main = (colornumber_main + 1) % totalcolors_main;
// pega a cor natural
colors = colors[colornumber_main];
// Atualiza ponteiros and funds
normal_analog_clock_pro_hour_pointer_img.setProperty(hmUI.prop.SRC, `pontHor${colornumber_main+1}.png`);
normal_analog_clock_pro_minute_pointer_img.setProperty(hmUI.prop.SRC, `pontMin${colornumber_main+1}.png`);
normal_analog_clock_pro_second_pointer_img.setProperty(hmUI.prop.SRC, `pontSec${colornumber_main+1}.png`);
normal_background_bg_img.setProperty(hmUI.prop.SRC, `Back${colornumber_main+1}.png`);
// aplica a cor ao círculo a bateria
normal_battery_circle_scale.setProperty(hmUI.prop.MORE, {
color: colorss,
radius: 27,
line_width: 16
});
// normal_battery_current_text_font.setProperty(hmUI.prop.COLOR, colorss); // not work in this case
// use this to change color
normal_battery_current_text_font.setProperty(hmUI.prop.MORE, {
x: 192,
y: 74,
w: 32,
h: 25,
text_size: 20,
char_space: 0,
font: 'fonts/Panton-Bold.ttf',
color: colorss ,
line_space: 0,
align_v: hmUI.align.TOP,
text_style: hmUI.text_style.ELLIPSIS,
align_h: hmUI.align.CENTER_H,
type: hmUI.data_type.BATTERY,
show_level: hmUI.show_level.ONLY_NORMAL,
});
normal_day_text_font.setProperty(hmUI.prop.COLOR, colorss);
normal_time_hour_text_font.setProperty(hmUI.prop.COLOR, colorss);
normal_time_minute_text_font.setProperty(hmUI.prop.COLOR, colorss);
}
// end user_functions.js
However, ZeppPlayer cannot simulate the "normal_battery_current_text_font" widget, so I do not have preview image for you, butI tested it on my Bip 6.
The battery color changes normally.
I've attached the edited file.
For GTRMiNi :
You can see edited in index.js.