Hi there!
In an Automagic widget, is it somehow possible to change the fill color of a text section without changing the fill color of the whole text element? For example, having the base color of the text in black, but change a few words to red.
Change color of a text section in a widget
Moderator: Martin
Re: Change color of a text section in a widget
You mean a single text element but with 2 different color? (example first 2 words is green and the rest are red.) You can't, each single text element can only have single color. If you need to change certain part, you should split them to 2 different text element instead, and modify each by itself.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 31
- Joined: 27 May 2017 11:19
Re: Change color of a text section in a widget
Yes. Ah, too bad... The words to be colored won't appear in the same place (the length of of text before the differently colored text changes from time to time), so I can just split it up in different elements. I'll try build it in a other way.
Thanks for the answer!
Thanks for the answer!
Re: Change color of a text section in a widget
I just remember digitalstone ever asked the similar here : viewtopic.php?f=5&t=7135
He is trying to auto adjust the text box element size depends on the text length.
I found out that Automagic has supported Monospace font in the widget font type. So you can try to use monospace font and count the text box size. Use length(text) to count the length of the text and multiply by the number of the total character that the text box can hold, make it a round number, so easier to arrange. Example if your text box is 400 and can hold 10 characters, means each char is 40 pixels (monospace font has same length for all char). Adjust the first textbox width according to the length of the text. Then then second text box, adjust the x from the left based on the length of the first text box. Then modify each textbox color individidually. Takes several script to do each round, but can be done
Original
This is text one. This is text two
Text one shortened
Text 1. The text one has shortened
He is trying to auto adjust the text box element size depends on the text length.
I found out that Automagic has supported Monospace font in the widget font type. So you can try to use monospace font and count the text box size. Use length(text) to count the length of the text and multiply by the number of the total character that the text box can hold, make it a round number, so easier to arrange. Example if your text box is 400 and can hold 10 characters, means each char is 40 pixels (monospace font has same length for all char). Adjust the first textbox width according to the length of the text. Then then second text box, adjust the x from the left based on the length of the first text box. Then modify each textbox color individidually. Takes several script to do each round, but can be done
Original
This is text one. This is text two
Text one shortened
Text 1. The text one has shortened
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
- digitalstone
- Posts: 342
- Joined: 21 Oct 2017 12:36
- Location: The Netherlands
Re: Change color of a text section in a widget
Yes Monospace is a very functional font.
It's fontsize equals exactly each character's length in pixels.
Aesthetically not much to look at (unless you go for a 1984 look
) but perfect for calculating these type of text tricks.
In the end though, it's also about asking yourself if (merely) a cosmetic feature is worth the increasing hassle.
It's fontsize equals exactly each character's length in pixels.
Aesthetically not much to look at (unless you go for a 1984 look

In the end though, it's also about asking yourself if (merely) a cosmetic feature is worth the increasing hassle.
Phone: LG Nexus 5X (rooted vanilla Android 7.1.2)