Skip to main content

A terminal markup language, inspired by tml

Project description

Terminal Markup Language (tml)

  • A python library to make the output of colored text in the terminal easier and more readable.

Example

from tml import markup
print(markup("<red>this text is <bold>red</bold></red> and the following is <green>green</green>"))

Alternatively, you can use the mprint() function, which is a convenient shortcut.

from tml import mprint
mprint("<red>this text is <bold>red</bold></red> and the following is <green>green</green>")

You don't need to close the tag explicitly if it is not needed.

print(markup("<on-green><blue>this text has blue foreground on green background colors"))

If you would like to print brackets, use them in doubles:

print(markup("<bold>This is <<example>></bold>"))

Available Tags

Foreground

  • <black>
  • <red>
  • <green>
  • <yellow>
  • <blue>
  • <magenta>
  • <cyan>
  • <white>
  • <bright-black>
  • <light-black>
  • <bright-red>
  • <light-red>
  • <bright-green>
  • <light-green>
  • <bright-yellow>
  • <light-yellow>
  • <bright-blue>
  • <light-blue>
  • <bright-magenta>
  • <light-magenta>
  • <bright-cyan>
  • <light-cyan>
  • <bright-white>
  • <light-white>

Background

  • <on-black>
  • <on-red>
  • <on-green>
  • <on-yellow>
  • <on-blue>
  • <on-magenta>
  • <on-cyan>
  • <on-white>
  • <on-bright-black>
  • <on-light-black>
  • <on-bright-red>
  • <on-light-red>
  • <on-bright-green>
  • <on-light-green>
  • <on-bright-yellow>
  • <on-light-yellow>
  • <on-bright-blue>
  • <on-light-blue>
  • <on-bright-magenta>
  • <on-light-magenta>
  • <on-bright-cyan>
  • <on-light-cyan>

Attributes

  • <bold>
  • <b>
  • <dark>
  • <italic>
  • <i>
  • <underline>
  • <u>
  • <blink>
  • <reverse>
  • <concealed>
  • <strike>

Acknowledgement

  • This library is inspired by tml

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python_tml-1.0.2.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

python_tml-1.0.2-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page