Thank you, that function worked great and come to think about it I can
have use for it too. =) However as you said you know that's not what I
wanted.
So, let me explain for you exactly what I'm trying to do. I want to
highlight a name with a color scheme. So the first part of the name
would start with dark colors, the middle part with bright colors and the
last part back to dark colors. This can be done with different type of
colors. I will use grey, white and bright white in this example and the
name I use in this example is "Desindit".

I call the function by:
colorize_string( "name", "DwW" ); // D = Grey, w = White, W =
BrightWhite

The result I would want is:

D is colored as &D
e is colored as &w
s is colored as &W
i is colored as &W
n is colored as &W
d is colored as &W
i is colored as &w
t is colored as &D

This is fine too:

D is colored as &D
e is colored as &D
s is colored as &w
i is colored as &W
n is colored as &W
d is colored as &w
i is colored as &D
t is colored as &D

Even this:

D is colored as &D
e is colored as &w
s is colored as &w
i is colored as &W
n is colored as &W
d is colored as &w
i is colored as &w
t is colored as &D

However, the result is best from example 1 or 2.

You're asking about 9 or 5 character names. Yes ok, solution to that is
to always color the letter that's left from dividing the character name
into 2 parts to the last color of first part or the first color of the
last part which should be same. :) However if the name is 4 or 3
characters, things won't really work if we use 3 colors to hightlight a
string. Solution to that would maybe be not to allow colorizing of a
such string or we could always make an exception to a such string and do
a little hack by colorizing it a "hardcoded way".

Ok, ok, things got more complicated than I thought. I do not know how to
continue from here. Yes ok, split the name into two parts.
Colorize the first part &D &w &W and if it's an odd character number
colorize the letter that's left after dividing it by 2 to &W.
Now to the last part, colorize it &W &w &k.
Hmm when I think about it what about 5 character names...
Have to make an exception here too, since &D &w &W &w &D is a total of 5
characters and is odd... so can't really colorize the letter that's left
to
the same color that the first part "&D &w" starts with or the first
color of the last part "&w &D" as that would result in "&k &w &w &w &k".
Bah, should I just give up?? :P


Reply via email to