Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libGDX : Multi-color text in one label

Tags:

java

libgdx

I saw this post Multi-colored text in libgdx but it's not useful specially in new API.

For example: I want to color "libGDX" text like this: enter image description here

BitmapFont font = new BitmapFont(Gdx.files.internal("fonts/CarterOne.fnt"));
LabelStyle style = new LabelStyle(font, null);
Label label = new Label("libGDX", style);
stage.addActor(label);

How can I do this ?

like image 768
iibrahimbakr Avatar asked Nov 01 '15 18:11

iibrahimbakr


1 Answers

You can do this easily with the color markup language that Label supports as well.

Make sure to read that article completely, as there are a few little obstacles involved to get it working.

like image 172
noone Avatar answered Oct 02 '22 21:10

noone