Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
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 (23,133 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 (23,133 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.
20,575 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top