sty

String styling for your terminal.

https://github.com/feluxe/sty

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.3%) to scientific vocabulary

Keywords

color coloring command-line python python3 string styling terminal terminal-based
Last synced: 6 months ago · JSON representation

Repository

String styling for your terminal.

Basic Info
  • Host: GitHub
  • Owner: feluxe
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Homepage: https://sty.mewo.dev
  • Size: 6.82 MB
Statistics
  • Stars: 215
  • Watchers: 4
  • Forks: 9
  • Open Issues: 11
  • Releases: 16
Topics
color coloring command-line python python3 string styling terminal terminal-based
Created about 8 years ago · Last pushed about 2 years ago
Metadata Files
Readme License

README.rst

.. image:: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_logo_aliased.svg
   :target: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_logo_aliased.svg
   :alt: sty_logo
   :width: 30%
   :class: intro-logo

|

|badge-total-downloads| |badge-monthly-downloads|

.. |badge-total-downloads| image:: https://static.pepy.tech/personalized-badge/sty?period=total&units=international_system&left_color=grey&right_color=lightgrey&left_text=downloads
   :target: https://static.pepy.tech/personalized-badge/sty?period=total&units=international_system&left_color=grey&right_color=lightgrey&left_text=downloads
   :alt: badge-total-downloads

.. |badge-monthly-downloads| image:: https://static.pepy.tech/personalized-badge/sty?period=month&units=international_system&left_color=grey&right_color=lightgrey&left_text=downloads/month
   :target: https://static.pepy.tech/personalized-badge/sty?period=month&units=international_system&left_color=grey&right_color=lightgrey&left_text=downloads/month
   :alt: badge-monthly-downloads

------------

.. image:: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_demo.png
   :target: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_demo.png
   :alt: sty_demo
   :width: 100%


Release 1.0.6 (November 27. 2023)
---------------------------------

Code Changes:

* Use PEP-484 compatible exports to satisfy static type checkers.


Release 1.0.5 (November 22. 2023)
---------------------------------

Code Changes:

* Add `py.typed` file for better typing support. Thanks! @Eisfunke
* Use explicit imports: `from .lib import` is now `from sty.lib import`.
* More and better doc-strings. `help(x)` should be much more useful now.

Other:

* Add svg logo. Thanks! @kubinka0505
* Replace `pipenv` with `poetry`.
* Remove `make.py` build system.
* Remove all dev dependencies.


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
------------

.. code:: python

    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:

.. image:: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_example.png
   :target: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_example.png
   :alt: example
   :width: 600px


You can use the `Register` class or the default registers `FgRegister`, `BgRegister`, `EfRegister` and `RsRegister` to create your own registers:

.. code:: python

    # Extending the default FgRegister

    from sty import FgRegister, Style, RgbFg, Sgr

    class MyFgRegister(FgRegister):

        def __init__(self):
            super().__init__()

            self.purple = Style(Sgr(35))
            self.blue = Style(Sgr(34))
            self.orange = Style(RgbFg(255, 128, 0))
            # ...

     fg = MyFgRegister()


Documentation
-------------

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

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

Owner

  • Name: Felix Meyer-Wolters
  • Login: feluxe
  • Kind: user
  • Location: Planet Earth

I'm a full-stack developer from Germany. I'm interested in tech of all kinds with a main focus on web services and fine art tech.

GitHub Events

Total
  • Issues event: 1
  • Watch event: 13
  • Issue comment event: 1
  • Pull request event: 1
  • Fork event: 2
Last Year
  • Issues event: 1
  • Watch event: 13
  • Issue comment event: 1
  • Pull request event: 1
  • Fork event: 2

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 121
  • Total Committers: 3
  • Avg Commits per committer: 40.333
  • Development Distribution Score (DDS): 0.017
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
feluxe f****x@m****e 119
technikian 4****n 1
Nicolas Lenz n****s@e****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 45
  • Total pull requests: 12
  • Average time to close issues: 5 months
  • Average time to close pull requests: 7 months
  • Total issue authors: 26
  • Total pull request authors: 5
  • Average comments per issue: 2.78
  • Average comments per pull request: 1.67
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 7
Past Year
  • Issues: 1
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • feluxe (15)
  • rysson (3)
  • kubinka0505 (2)
  • mar10 (2)
  • alexpreynolds (1)
  • Jekaija (1)
  • l0vern (1)
  • ChopsKingsland (1)
  • gte620v (1)
  • mcaay (1)
  • darkyelox (1)
  • zingfrid (1)
  • spenserblack (1)
  • outcastdreamer (1)
  • HJarausch (1)
Pull Request Authors
  • dependabot[bot] (7)
  • rysson (2)
  • technikian (1)
  • MareoRaft (1)
  • Eisfunke (1)
Top Labels
Issue Labels
enhancement (8) documentation (5) legacy compatibility (3) next release (3) breaking (2) v1.0 (2) planning (2) experiment (2) cleanup (2) discussion (1) poll (1) organisational (1) thirdparty-issue (1) implementation detail (1)
Pull Request Labels
dependencies (7)

Packages

  • Total packages: 3
  • Total downloads:
    • pypi 72,546 last-month
  • Total docker downloads: 469
  • Total dependent packages: 34
    (may contain duplicates)
  • Total dependent repositories: 170
    (may contain duplicates)
  • Total versions: 28
  • Total maintainers: 1
pypi.org: sty

String styling for your terminal

  • Versions: 22
  • Dependent Packages: 32
  • Dependent Repositories: 170
  • Downloads: 72,472 Last month
  • Docker Downloads: 469
Rankings
Dependent packages count: 0.4%
Dependent repos count: 1.2%
Docker downloads count: 2.3%
Downloads: 2.5%
Average: 4.1%
Stargazers count: 5.0%
Forks count: 13.3%
Maintainers (1)
Last synced: 6 months ago
pypi.org: aioexec

asyncio executors, clean and simple.

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 74 Last month
Rankings
Stargazers count: 5.0%
Dependent packages count: 10.0%
Forks count: 13.3%
Downloads: 18.9%
Average: 22.9%
Dependent repos count: 67.4%
Maintainers (1)
Last synced: 6 months ago
conda-forge.org: sty

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.

  • Versions: 1
  • Dependent Packages: 2
  • Dependent Repositories: 0
Rankings
Dependent packages count: 19.5%
Stargazers count: 24.9%
Average: 31.5%
Dependent repos count: 34.0%
Forks count: 47.7%
Last synced: 6 months ago

Dependencies

poetry.lock pypi
pyproject.toml pypi
  • python ^3.7