How to join two Style[]d strings
Use Row
to join them:
Omega = "text";
joined = Row[{Style[Omega, Lighter[Blue, .1]], Style[Omega, Darker[LightBlue, .1]]}];
Print[joined]
Given two styled items:
omega = "text"
items = { Style[omega,Lighter[Blue,.1]], Style[omega,Darker[LightBlue,.1]] }
We can produce a single string with both stylings if we convert each item into a StandardForm
string prior to joining them:
Apply[StringJoin, ToString[#, StandardForm] & /@ items]
The following screenshot shows the results:
If you evaluate or print the following string you get what you want:
"\!\(\*StyleBox[\"text\",FontColor->RGBColor[1, 0, 0]]\) \!\(\*StyleBox[\"text\",FontColor->RGBColor[0, 0, 1]]\)"
This is a single string and it contains color information for different substrings.
Do[Print@"\!\(\*StyleBox[\"text\",FontColor->RGBColor[1, 0, 0]]\) \!\(\*StyleBox[\"text\",FontColor->RGBColor[0, 0, 1]]\)", {5}]