GithubHelp home page GithubHelp logo

p-ranav / sty Goto Github PK

View Code? Open in Web Editor NEW

This project forked from feluxe/sty

0.0 1.0 0.0 7 MB

String styling for your terminal.

Home Page: https://sty.mewo.dev

License: Apache License 2.0

Python 100.00%

sty's Introduction

sty_logo

badge-total-downloads badge-monthly-downloads


sty_demo

Release 1.0.0 (February 05. 2022)

Sty v1.0.0 released ๐ŸŽ‰

At this point sty can be considered stable.

The "release candidate" phase was given a lot of time and nothing critical was reported for a while. All features that are planned for the future are compatible with the existing interfaces.

Nothing changed since rc.2.

Release 1.0.0-rc.2 (August 28. 2021)

  • Fix typo in "reset" register.

Release Note (Breaking Changes)

Release 1.0.0-rc.1 (January 31. 2021)

  • Sty is now fully typed.
  • Deprecated methods .set_style(...) and .get_style(...) were finally removed.

Release Note

Release 1.0.0-rc.0 (January 08. 2021)

Sty version 1.0.0 is now feature complete.

  • I'm going to support Python version >=3.7 indefinitely.
  • Sty will follow semver so there won't be any breaking changes for version 1.x.x after 1.0.0 was released.
  • This is a pre-release (rc.0). I'll release 1.0.0 in a couple of month if no major bugs are reported.

Release Note (Breaking Changes)

Description

Sty's goal is to provide Python with a simple, customizable and performant string styling markup, which is decoupled from color palettes and terminal implementations.

  • Sty supports 3/4bit, 8bit and 24bit (truecolor/RGB) colors as well as effects like bold, italic, underline, etc.
  • Sty should work on most Unix platforms with most terminals. It works with recent Windows terminals. Window legacy terminal (cmd) needs a shim to work.
  • Sty comes with default color palettes and renderers, but you can easily replace/customize them, without touching the markup in your code.
  • Sty allows you to mute/unmute all styles in your codebase.
  • Sty provides high access performance for all styling rules.
  • Sty is fully typed, you should get good editor support for it.
  • Sty does not implicitly mess with globals. E.g.: colorama overrides sys.stdout which causes a lot of trouble.
  • Sty has no dependencies.
  • Sty follows semver
  • Sty will support Python >=3.7 for as long as possible.

If you run into compatibility problems with sty, please file an issue!

Code Example

from sty import fg, bg, ef, rs

foo = fg.red + 'This is red text!' + fg.rs
bar = bg.blue + 'This has a blue background!' + bg.rs
baz = ef.italic + 'This is italic text' + rs.italic
qux = fg(201) + 'This is pink text using 8bit colors' + fg.rs
qui = fg(255, 10, 10) + 'This is red text using 24bit colors.' + fg.rs

# Add custom colors:

from sty import Style, RgbFg

fg.orange = Style(RgbFg(255, 150, 50))

buf = fg.orange + 'Yay, Im orange.' + fg.rs

print(foo, bar, baz, qux, qui, buf, sep='\n')

The code above will print like this in the terminal:

example

Documentation

Documentation-Website: https://sty.mewo.dev

Documentation-Website-Source: https://github.com/feluxe/sty-docs

sty's People

Contributors

feluxe avatar technikker avatar

Watchers

 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.