Getting the ansi color data.

Posted by Smorly on Sat 09 Feb 2013 08:50 PM — 6 posts, 27,353 views.

#0
So when using GetStyleInfo() to get colour information, we get an RGB colour.

How do I convert that into an ANSI escape sequence, given that Ansi() takes the ansi escape number?

Is the RGB colour the one that is displayed? That is, if a user changes blue to green-blue, will RGBColourToName return blue or green-blue?
#1
If there's nothing built-in, I have the solution already.

Will post code if anyone wants it.
Australia Forum Administrator #2
The colour returned should be what is displayed. ANSI colours are usually looked up, and converted into RGB at the last moment. Not every RGB colour will necessarily have an ANSI equivalent.
#3
I was able to translate the displayed colour to ANSI using world.NormalColour and .BoldColour
Australia Forum Administrator #4
If you are just redisplaying in another window (or a miniwindow) then the RGB codes should be all you need.
#5
Unless a user expects the parameters that he configures under ANSI Color Data to work properly in the target window.

Also, I need the ANSI data to compose colour messages back to the server.