t.w.p.i.assembleFormattedText(formatted) : function documentation

Part of twisted.words.protocols.irc View Source

Assemble formatted text from structured information.

Currently handled formatting includes: bold, reverse, underline, mIRC color codes and the ability to remove all current formatting.

It is worth noting that assembled text will always begin with the control code to disable other attributes for the sake of correctness.

For example:

   from twisted.words.protocols.irc import attributes as A
   assembleFormattedText(
       A.normal[A.bold['Time: '], A.fg.lightRed['Now!']])

Would produce "Time: " in bold formatting, followed by "Now!" with a foreground color of light red and without any additional formatting.

Available attributes are:

Available colors are:

  1. white
  2. black
  3. blue
  4. green
  5. light red
  6. red
  7. magenta
  8. orange
  9. yellow
  10. light green
  11. cyan
  12. light cyan
  13. light blue
  14. light magenta
  15. gray
  16. light gray
ParametersformattedStructured text and attributes.
ReturnsString containing mIRC control sequences that mimic those specified by formatted. (type: str)
See Alsohttp://www.mirc.co.uk/help/color.txt
Present Since13.1
API Documentation for Twisted, generated by pydoctor at 2013-11-08 22:07:30.