Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: colored alphabet for string output

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48251] Re: colored alphabet for string output
  • From: Mike <m.HoneychurcNOSPAMh at uq.edu.au>
  • Date: Wed, 19 May 2004 02:42:45 -0400 (EDT)
  • Organization: University of Queensland
  • References: <c89pot$t2s$1@smc.vnet.net> <c8ch4c$emp$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

I was unaware of ToColor. How did you find out about it?

I searched the online help guide and the only "hit" was for warning messages
ToColor::

I guess this must be an undocumented function???


Mike

V5.0.1 on Mac OS X 10.3.3


On 18/5/04 6:22 PM, in article c8ch4c$emp$1 at smc.vnet.net, "Jens-Peer Kuska"
<kuska at informatik.uni-leipzig.de> wrote:

> 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
> 


  • Prev by Date: Re: setdirectory doesn't work.anymore
  • Next by Date: RE: Fonts and Plot
  • Previous by thread: Re: colored alphabet for string output
  • Next by thread: Re: colored alphabet for string output