 
 
 
 
 
 
Re: colored alphabet for string output
- To: mathgroup at smc.vnet.net
- Subject: [mg48201] Re: colored alphabet for string output
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Tue, 18 May 2004 04:16:00 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <c89pot$t2s$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
- Sender: owner-wri-mathgroup at wolfram.com
Hi,
myList = {"abcdefg", "hijklmn", "prstuv"};
randomColor[] := ToColor[Hue[Random[]], RGBColor];
colorString[str_String] := Module[{ss},
    ss = Characters[str];
    RowBox[StyleForm[#, FontColor -> randomColor[]] & /@ ss]
    ]
colorString /@ myList // DisplayForm
Regards
  Jens
Curt Fischer wrote:
> 
> Dear Group:
> 
> I have a long list of alphabetic strings.  I would like to ouput this list,
> with each of the letters of the string colored differently.  How could I do
> this?
> 
> For example:
> 
> myList = {"abcdefg","hijklmn","prstuv"};
> 
> myList/.{x_String -> StringReplace[x, "a" -> StyleForm["a", FontColor ->
> Red]]}
> 
> I was thinking to hodgepodge together statements like this, but it doesn't
> work because StringReplace requires objects with head String, and my attempt
> has an object with head StyleForm.
> 
> Any advice?
> 
> --
> Curt Fischer

