Gammon Forum
Entire forum
MUSHclient
Python
Getting the ansi color data.
Getting the ansi color data.
|
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Smorly
(31 posts) bio
|
Date
| Sat 09 Feb 2013 08:50 PM (UTC) |
Message
| 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? | top |
|
Posted by
| Smorly
(31 posts) bio
|
Date
| Reply #1 on Sat 09 Feb 2013 09:37 PM (UTC) |
Message
| If there's nothing built-in, I have the solution already.
Will post code if anyone wants it. | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #2 on Sat 09 Feb 2013 11:35 PM (UTC) |
Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Smorly
(31 posts) bio
|
Date
| Reply #3 on Sun 10 Feb 2013 12:25 AM (UTC) |
Message
| I was able to translate the displayed colour to ANSI using world.NormalColour and .BoldColour | top |
|
Posted by
| Nick Gammon
Australia (22,975 posts) bio
Forum Administrator |
Date
| Reply #4 on Sun 10 Feb 2013 08:31 PM (UTC) |
Message
| If you are just redisplaying in another window (or a miniwindow) then the RGB codes should be all you need. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
Posted by
| Smorly
(31 posts) bio
|
Date
| Reply #5 on Sun 10 Feb 2013 09:09 PM (UTC) Amended on Sun 10 Feb 2013 09:19 PM (UTC) by Smorly
|
Message
| 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. | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
18,249 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.