0 Favourites

How to set font color for a word with find()?

  • I would like to learn how to set font color for a word using find(src, text)?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Here is a starting point:

    http://dl.dropbox.com/u/5426011/examples14/word_highlight.capx

    It finds the position of a word and then breaks the text into 3 separate instances (text prior to word, word, and text after). You can then change to color of the word independent of the rest of the text.

    In it's current state it only works with one text line, and finds only one word to highlight.

    Here's a list of what could be done to enhance the technique in roughly increasing difficulty:

    * Make it work with multiple text objects.

    * Make it highlight all occurrences of a word in a line.

    * Make it able to highlight different words to different colors.

    * Make it work with multi-line text.

    I would take a look at the plugins to see if there are any that allow for displaying formatted html text as that would simplify it by replacing words like "green" with say "[_COLOR=#00ff00_]green[_/COLOR_]".

  • Here is a starting point:

    http://dl.dropbox.com/u/5426011/examples14/word_highlight.capx

    It finds the position of a word and then breaks the text into 3 separate instances (text prior to word, word, and text after). You can then change to color of the word independent of the rest of the text.

    In it's current state it only works with one text line, and finds only one word to highlight.

    Here's a list of what could be done to enhance the technique in roughly increasing difficulty:

    * Make it work with multiple text objects.

    * Make it highlight all occurrences of a word in a line.

    * Make it able to highlight different words to different colors.

    * Make it work with multi-line text.

    I would take a look at the plugins to see if there are any that allow for displaying formatted html text as that would simplify it by replacing words like "green" with say "[_COLOR=#00ff00_]green[_/COLOR_]".

    R0J0hound delivers the best reply, thanks a lot. I tought Pode's HTML plugin there are html format can easily setup a color for a word, i'm not sure it can be dynamically done. I will try a test.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,375
RetroDaddy's avatar
RetroDaddy
Unread hot topic
0 Favourites
3 word story
120 11,708
MPPlantOfficial's avatar
MPPlantOfficial
Unread hot topic
118 32,905
rexrainbow's avatar
rexrainbow