Code Monkey home page Code Monkey logo

godot-bbcode-to-ansi's Introduction

Godot BBCode to ANSI escape code converter

This can be used for colored console printing.

Not functional on Windows 10 and later yet, as Godot doesn't enable virtual terminal processing yet.

Features

Note: Some of these features will only work in certain terminals. This is especially the case for italic and strikethrough where terminal support can be spotty.

  • Bold/italic/underline/strikethrough ([b], [i], [u], [s]).
  • [code] tag (doesn't change font, but appears as "faint" in supported terminals).
  • [center]/[right] alignment (doesn't take terminal width into account – emulated using tab characters).
  • [indent] tag (emulated using 4 spaces).
  • 16-color and 256-color ANSI codes for [color] (text color) and [bgcolor] (background color, used for highlighting text).
    • Only named colors such as red, green, blue are supported.
    • True color ANSI codes could be supported, but terminal support for them is not universal due to macOS's Terminal.app not supporting truecolor. Therefore, some named colors are approximated with a 256-color palette optimized for readability on dark and light backgrounds.
  • [fgcolor] (redacted text) emulation using the same color as foreground and background.
  • [url] (unnamed URLs only). This works by stripping the tag and letting the terminal recognize URLs as-is.
    • [url=...] is not supported as terminal support for it isn't widespread enough as of April 2022.

For tags other than [color], [bgcolor] and [fgcolor], tags can be contained within each other and formatting will be preserved as done in RichTextLabel. For color tags, it's possible to get the same visual appearance without nesting tags (but it may be less convenient to script on your end).

License

Copyright © 2022 Hugo Locurcio and contributors

Unless otherwise specified, files in this repository are licensed under the MIT license. See LICENSE.md for more information.

godot-bbcode-to-ansi's People

Contributors

calinou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

boyquotes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.