is it possible to have multi color in a single CCLabelTTF?

is it possible to have multi color in a single CCLabelTTF?
0.0 0


in my project when there are keyword words appear in sentence those keyword must be on difference color

currently im tired use something like this

string a: “hello test this is ****” and
strinb b: "_ _ keyword"
and make two strings to be the same position but in this way the
will be appeared (cannot use ‘’ since it will make word-wrap work incorrectly )

it it possible to do so? any work around?

sorry for my english. thx


yes,Is it Possible. But using CCLabelBMFont type label.In this type label you can access the separate character.
you can do that Using Simply CCLabelBMFont. Because you can simply Access the Each character using index value.

Example : -

//create Label like this
CCLabelBMFont *lblInfo = [CCLabelBMFont labelWithString:@“Multi Color Label” fntFile:@“SSPro.fnt”];

then, you can Access the character using Index path.

for (i=starting index; i<ending index; i ++) {

    CCSprite *charSprite = (CCSprite *)[[lblInfo children] objectAtIndex:i];
    charSprite.color = [CCColor redColor];

set or change the color of character.


You can write a component class. For example: ESMultiColorLabel:
ESMultiLabel *label = ESMultiLabel::create("{{color=0xff6633}}plain text{{color=0x00ff00;text=green text}}plain text 2");