I am working on a client in Pharo for which I want to be able to color different pieces of text in different colors (the text stream I'm receiving has ANSI escape codes, and I'll be parsing those and coloring the text appropriately for display). But I have not been able to figure out how to get text color to appear. I would expect to see the text appear in lightBlue, but it all appears black just like before. Anyone know the solution to coloring text inside Spec widgets?I set up a simple UI in Spec, using a TextModel for my display. To see if coloring worked, I sent updates to the display via: textToAdd := TextMorph new contents: (Character linefeed asString, text asString). displayField pendingText: (textToAdd textColor: Color lightBlue). displayField accept. |
Hi erik
right now I do not know. I'm not sure that spec handles well coloring. Do you have an example that we can play with? Stef Le 18/1/15 18:41, Erik Stayton a écrit : > I am working on a client in Pharo for which I want to be able to color > different pieces of text in different colors (the text stream I'm > receiving has ANSI escape codes, and I'll be parsing those and > coloring the text appropriately for display). But I have not been able > to figure out how to get text color to appear. > > I set up a simple UI in Spec, using a TextModel for my display. To see > if coloring worked, I sent updates to the display via: > > textToAdd := TextMorph new contents: (Character linefeed > asString, text asString). > displayField pendingText: (textToAdd textColor: Color lightBlue). > displayField accept. > > I would expect to see the text appear in lightBlue, but it all appears > black just like before. Anyone know the solution to coloring text > inside Spec widgets? |
Hi Stef, I don't have a good minimal example to hand, but my UI is just a simple Spec model with two widgets, the aforementioned TextModel and a TextInputFieldModel that I use to actually take user commands.
I am not wedded to Spec, if it doesn't handle colors well. If it is a long-shot to get it working I will pick something else. Would it be better to go for a straight Morph setup? Is that what the system browser uses to get its syntax highlighting/colors? I can put together a minimal example so people can play with Spec and see if it works, but if I'm better off dropping Spec I can jump straight to that. Thoughts? Thanks again, Erik |
There is a working example of text coloring in my toy MUD client http://smalltalkhub.com/#!/~AlexanderSvyazin/MudTalk. It actually has support of ANSI escape sequences (only colors yet) :) For now it uses plain Morph, not Spec, AFAIR Spec text model was not flexible enough for my needs and it was too hard to extend for me (but I don't remember the details). This client should work in last release version of Pharo and last development version too (I use development version), just load ConfigurationOfMudTalk and run 'ConfigurationOfMudTalk loadDevelopment'. It is slightly structured pile of code but it's a toy and educational project so I'm trying to use *everything* that I see. On Tue, Jan 20, 2015 at 3:51 AM, ErikStayton <[hidden email]> wrote: Hi Stef, I don't have a good minimal example to hand, but my UI is just a |
Le 20/1/15 05:57, Alexander Svyazin a
écrit :
I agree and this is something that we will have to think about.
always good to have this kind of resources. Thanks Alexander
|
In reply to this post by ErikStayton
Better go morph
Le 19/1/15 23:51, ErikStayton a écrit : > Hi Stef, I don't have a good minimal example to hand, but my UI is just a > simple Spec model with two widgets, the aforementioned TextModel and a > TextInputFieldModel that I use to actually take user commands. > > I am not wedded to Spec, if it doesn't handle colors well. If it is a > long-shot to get it working I will pick something else. Would it be better > to go for a straight Morph setup? Is that what the system browser uses to > get its syntax highlighting/colors? > > I can put together a minimal example so people can play with Spec and see if > it works, but if I'm better off dropping Spec I can jump straight to that. > Thoughts? > > Thanks again, > Erik > > > > -- > View this message in context: http://forum.world.st/Best-approach-to-multiple-text-colors-in-Spec-tp4800245p4800541.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. > > |
In reply to this post by Alexander Svyazin
Thanks for pointing me to that, I will check it out! ErikOn Mon, Jan 19, 2015 at 11:54 PM, Alexander Svyazin [via Smalltalk] <[hidden email]> wrote:
|
Free forum by Nabble | Edit this page |