Deprecation warning: %c type colouring

70 views
Skip to first unread message

Griatch Art

unread,
Jan 26, 2014, 1:49:05 PM1/26/14
to eve...@googlegroups.com
Hi folks,

This is a heads-up that the %c-type formatting syntax is getting deprecated. It still works but may go away in the future.

%c syntax is highly unsuitable for a Python mud since it clashes with Python string formatting. It used to be that the only way to produce certain text effects (such as coloured background) could only be accomplished with %c style formatting. This is now remedied as the {-style formatting was revamped using e.g. {r and {[r for red foreground and background respectively (or {500, {[500 in Xterm256).

You can read more about the text formatting options in the updated wiki page.


In other news, there is also a new ANSIString datatype to be found in utils/ansi.py, courtesy of Kelketek. This allows for ANSI-aware string operations. We'll see what uses it gets (most likely in the prettytable module to begin with).
.
Griatch

Griatch Art

unread,
Mar 7, 2015, 1:25:17 PM3/7/15
to eve...@googlegroups.com
Time to bump this topic I think.

Noone commented on this announcement originally, but it's worth for people to be aware of: The %c-style color tags are deprecated, have been for more than a year now. This means that we will drop support for %c-style color syntax in the (now nearer) future. Read the original post for the motivations. See also https://github.com/evennia/evennia/issues/683. So if you are used to %c style tags you need to start rethinking: {- style tags are where it's at.
.
Griatch

Griatch Art

unread,
Mar 24, 2015, 11:12:32 AM3/24/15
to eve...@googlegroups.com
The `{`- style tags should now cover all possibilities that `%c` style tags can handle and then some.

Some changes:

  •  Bright backgrounds. You can now use `{[b` for a bright blue background and `{[B` for a normal (darker) background. Since ANSI standard doesn't actually support brighter backgrounds, this functionality is implemented with Xterm256 colors behind the scenes. If your client doesn't support Xterm256, all backgrounds will be 'normal' intensity (standard ANSI).
  • `{!#` - tags were added. These are always upper-case since they are normal-intensity, such as `{!R`. These are color tags that "bleed", that is, they are not auto-set to be bright/normal intensity as the normal `{`- style tags are. This means that you can use the highlight tags below to change the intensity of a bunch of following tags in one go, for example. Backgrounds have no equivalence.
  • `{h`, `{H` tags were added to allow the changing of the intensity (bright/normal) of  `{!`- style tags above.

Normally, the `{` style tags should be the most commonly useful tags for easily color-marking colours, but the `{!`-tags may have some use for more advanced designs or for dynamically changing intensity mode etc. 
.
Griatch
Reply all
Reply to author
Forward
0 new messages