Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I change the default font color? #76

Open
EMU-TIME opened this issue Jun 26, 2023 · 6 comments
Open

Can I change the default font color? #76

EMU-TIME opened this issue Jun 26, 2023 · 6 comments

Comments

@EMU-TIME
Copy link

Just move that 'T' up there, I want to change it to green.

If you change white and gray, the original white will also turn green.

I hope the next version has this feature, thank you.

@nickgammon
Copy link
Owner

I'm not sure what you mean. The default for text is non-bold white, which is a gray colour. What do you mean about white turning green?

@EMU-TIME
Copy link
Author

I'm not sure what you mean. The default for text is non-bold white, which is a gray colour. What do you mean about white turning green?

I hope the default text will turn green, and the other colors will not be changed.

@EMU-TIME
Copy link
Author

For example, I changed gray to dark green and white to bright green, but in this way, the colored characters that were originally supposed to output white and gray turned green.

@nickgammon
Copy link
Owner

OK, I see what you mean now. You want the default colour to be different from low-intensity white. You can achieve that by installing the following plugin, which detects ESC[0m (the ANSI code for return to default colours) and appends to it with ESC[38;5;46m which is a 256-ANSI colour code for green.

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="Make_Default_Colour_Green"
   author="Nick Gammon"
   id="a2888f9cacf9f9d52608105e"
   language="Lua"
   purpose="Makes the text colour green as default"
   date_written="2023-06-27 08:12:00"
   requires="4.37"
   version="1.0"
   >
</plugin>
<script>
<![CDATA[
local NEW_COLOUR = 46  -- change to suit your taste

function OnPluginPacketReceived (s)
  return (string.gsub (s, "\027%[0+m", "%0\027%[38;5;" .. NEW_COLOUR .. "m"))
end -- function OnPluginPacketReceived
]]>
</script>
</muclient>

You can choose the exact colour you want as the default colour from this chart:

colour_cube

I chose 46 however you could choose, say, 22, 34, or 40 which are different shades of green.


This plugin works by modifying incoming packets and adding the extra ANSI code for green after it receives an ANSI reset.

It won't work if the colour code spans multiple packets, but see if this works for you.

To install it, save the code part above as "Make_Default_Colour_Green.xml" and put that in your MUSHclient world/plugins folder. Then use the File menu to install that particular plugin.

@EMU-TIME
Copy link
Author

Thank you. After I installed it and enabled it, it displayed 'yes', but the default font is still gray. I restarted mushclient5.06 and it's still the same, I don't know why?

Enabled plugin Make_Default_Colour_Green (a2888f9cacf9f9d52608105e)

@nickgammon
Copy link
Owner

nickgammon commented Jun 27, 2023

We need to figure out what the MUD is sending.

  • Go to the Edit Menu -> Debug Packets (ie. turn it on). (Ctrl+Alt+F11)
  • Type LOOK or something to make the data from the MUD arrive, which should be in the default colour.
  • Turn packet debugging off (or the program will eventually slow down) (Ctrl+Alt+F11)
  • Switch to the packet debug window (Ctrl+Tab)
  • Copy from that window all or part of the packet which has the default coloured text in it.
  • Paste that in a reply here.

For example:

To the north is    54 6f 20 74 68 65 20 6e 6f 72 74 68 20 69 73 20
an intersection,   61 6e 20 69 6e 74 65 72 73 65 63 74 69 6f 6e 2c
 while Falcon..R   20 77 68 69 6c 65 20 46 61 6c 63 6f 6e 0a 0d 52
oad continues to   6f 61 64 20 63 6f 6e 74 69 6e 75 65 73 20 74 6f
 the south....[1   20 74 68 65 20 73 6f 75 74 68 2e 0a 0d 1b 5b 31
;37mExits: north   3b 33 37 6d 45 78 69 74 73 3a 20 6e 6f 72 74 68
 east south.....   20 65 61 73 74 20 73 6f 75 74 68 2e 0d 0a 0d 0a
.[0m<24/24 hp 14   1b 5b 30 6d 3c 32 34 2f 32 34 20 68 70 20 31 34
                   ^^^^^^^^^^^
                  ESC  [  0  m
                  
5/145 m 110/110    35 2f 31 34 35 20 6d 20 31 31 30 2f 31 31 30 20
mv 2000/37074175   6d 76 20 32 30 30 30 2f 33 37 30 37 34 31 37 35
0 xp> ÿúÉChar.St   30 20 78 70 3e 20 ff fa c9 43 68 61 72 2e 53 74

We should see ESC[0m in the packet as I illustrate above. Make sure you indicate what part of your text you expect to see in the default colour. In my example above I expect the prompt ("<24/24 hp 14 ...") to be in the default colour.

If we do, then my plugin should have worked. If not, well, we will cross the bridge when we come to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants