Coder Social home page Coder Social logo

kolanich-libs / richconsole.py Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 17 KB

A library to output rich text into a console using ECMA-48 escape sequences !!! Migrated to Codeberg ๐Ÿ”๏ธ !!!

Home Page: https://codeberg.org/KOLANICH-libs/RichConsole.py

License: The Unlicense

Python 43.27% Haxe 42.66% Jupyter Notebook 14.07%
ecma-48 ansi-escape-codes rich-text color ansi formatted-text cli ui colorama colored crayons colr chalk terminal-colors ansi-colors hue python command-line plumhum user-interface

richconsole.py's Introduction

RichConsole.py Unlicensed work

wheel (GHA via nightly.link) GitLab Build Status GitLab Coverage GitHub Actions Nโˆ… hard dependencies Libraries.io Status Code style: antiflash

We have moved to https://codeberg.org/KOLANICH-libs/RichConsole.py, grab new versions there.

Under the disguise of "better security" Micro$oft-owned GitHub has discriminated users of 1FA passwords while having commercial interest in success and wide adoption of FIDO 1FA specifications and Windows Hello implementation which it promotes as a replacement for passwords. It will result in dire consequencies and is competely inacceptable, read why.

If you don't want to participate in harming yourself, it is recommended to follow the lead and migrate somewhere away of GitHub and Micro$oft. Here is the list of alternatives and rationales to do it. If they delete the discussion, there are certain well-known places where you can get a copy of it. Read why you should also leave GitHub.


Yo dawg so we heard you like text styles so we put styles in your styles so you can style while you styling.

This is a tool to output "poor" (because it is limited by standardized control codes, which are very limited) rich text into a console. When dealing with control codes there is a problem with nesting styles because you have to restore the state, and the state you have to restore depends on the style of the level much distant from the one you are in. This library solves this problem.

You create a directed acyclic graph structure RichStr where each piece of string has its own styleSheet. After you have finished forming the output message you convert it into a string. The library does the rest.

How does it work?

The algorithm is damn simple: it just traverses the directed acyclic graph in depth-first way, determines exact style of each string, computes differences between them and emits control codes to apply them.

Requirements

  • A terminal supporting color codes.
    • Any Linux distro usually has one
    • Windows:
      • Windows 10 has built-in support
      • ansicon or ConEmu or MinTTY for older Windows
      • you can call colorama.init() to enable filtering the output with python, but this is VERY glitchy. It raises exceptions even on simple strings. The good thing in it that it supports more codes than ansicon.

Optional requirements

This library automatically imports colors and other control codes from the following libraries:

Tutorial

See Tutorial.ipynbNBViewer.

richconsole.py's People

Contributors

kolanich avatar

Watchers

 avatar  avatar

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.