.. 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 <https://github.com/feluxe/sty/issues/2#issuecomment-501890699>`__ 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 <https://semver.org/>`__.
* Sty will support Python `>=3.7` for as long as possible.
If you run into compatibility problems with sty, please file an `issue <https://github.com/feluxe/sty/issues>`__!
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
Raw data
{
"_id": null,
"home_page": "https://sty.mewo.dev/",
"name": "sty",
"maintainer": "feluxe",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "felix@meyerwolters.de",
"keywords": "styling,color,colour,terminal,ansi,command,line,cli",
"author": "feluxe",
"author_email": "felix@meyerwolters.de",
"download_url": "https://files.pythonhosted.org/packages/76/6a/aad1817e60f07e5ebc111affee15d4dff9d324981005310566c40f08786c/sty-1.0.6.tar.gz",
"platform": null,
"description": "\n.. image:: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_logo_aliased.svg\n :target: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_logo_aliased.svg\n :alt: sty_logo\n :width: 30%\n :class: intro-logo\n\n|\n\n|badge-total-downloads| |badge-monthly-downloads|\n\n.. |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\n :target: https://static.pepy.tech/personalized-badge/sty?period=total&units=international_system&left_color=grey&right_color=lightgrey&left_text=downloads\n :alt: badge-total-downloads\n\n.. |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\n :target: https://static.pepy.tech/personalized-badge/sty?period=month&units=international_system&left_color=grey&right_color=lightgrey&left_text=downloads/month\n :alt: badge-monthly-downloads\n\n------------\n\n.. image:: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_demo.png\n :target: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_demo.png\n :alt: sty_demo\n :width: 100%\n\n\nRelease 1.0.6 (November 27. 2023)\n---------------------------------\n\nCode Changes:\n\n* Use PEP-484 compatible exports to satisfy static type checkers.\n\n\nRelease 1.0.5 (November 22. 2023)\n---------------------------------\n\nCode Changes:\n\n* Add `py.typed` file for better typing support. Thanks! @Eisfunke\n* Use explicit imports: `from .lib import` is now `from sty.lib import`.\n* More and better doc-strings. `help(x)` should be much more useful now.\n\nOther:\n\n* Add svg logo. Thanks! @kubinka0505\n* Replace `pipenv` with `poetry`.\n* Remove `make.py` build system.\n* Remove all dev dependencies.\n\n\nDescription\n-----------\n\nSty's goal is to provide Python with a simple, customizable and performant string styling markup, which\nis decoupled from color palettes and terminal implementations.\n\n* Sty supports 3/4bit, 8bit and 24bit (truecolor/RGB) colors as well as effects like `bold`, `italic`, `underline`, etc.\n* Sty should work on most Unix platforms with most terminals. It works with recent Windows terminals. Window legacy terminal (cmd) needs a `shim <https://github.com/feluxe/sty/issues/2#issuecomment-501890699>`__ to work.\n* Sty comes with default color palettes and renderers, but you can easily replace/customize them, without touching the markup in your code.\n* Sty allows you to mute/unmute all styles in your codebase.\n* Sty provides high access performance for all styling rules.\n* Sty is fully typed, you should get good editor support for it.\n* Sty does not implicitly mess with globals. E.g.: `colorama` overrides `sys.stdout` which causes a lot of trouble.\n* Sty has no dependencies.\n* Sty follows `semver <https://semver.org/>`__.\n* Sty will support Python `>=3.7` for as long as possible.\n\nIf you run into compatibility problems with sty, please file an `issue <https://github.com/feluxe/sty/issues>`__!\n\n\nCode Example\n------------\n\n.. code:: python\n\n from sty import fg, bg, ef, rs\n\n foo = fg.red + 'This is red text!' + fg.rs\n bar = bg.blue + 'This has a blue background!' + bg.rs\n baz = ef.italic + 'This is italic text' + rs.italic\n qux = fg(201) + 'This is pink text using 8bit colors' + fg.rs\n qui = fg(255, 10, 10) + 'This is red text using 24bit colors.' + fg.rs\n\n # Add custom colors:\n\n from sty import Style, RgbFg\n\n fg.orange = Style(RgbFg(255, 150, 50))\n\n buf = fg.orange + 'Yay, Im orange.' + fg.rs\n\n print(foo, bar, baz, qux, qui, buf, sep='\\n')\n\n\nThe code above will print like this in the terminal:\n\n.. image:: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_example.png\n :target: https://raw.githubusercontent.com/feluxe/sty/master/assets/README_example.png\n :alt: example\n :width: 600px\n\n\nYou can use the `Register` class or the default registers `FgRegister`, `BgRegister`, `EfRegister` and `RsRegister` to create your own registers:\n\n.. code:: python\n\n # Extending the default FgRegister\n\n from sty import FgRegister, Style, RgbFg, Sgr\n\n class MyFgRegister(FgRegister):\n\n def __init__(self):\n super().__init__()\n\n self.purple = Style(Sgr(35))\n self.blue = Style(Sgr(34))\n self.orange = Style(RgbFg(255, 128, 0))\n # ...\n\n fg = MyFgRegister()\n\n\nDocumentation\n-------------\n\nDocumentation-Website: https://sty.mewo.dev\n\nDocumentation-Website-Source: https://github.com/feluxe/sty-docs\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "String styling for your terminal",
"version": "1.0.6",
"project_urls": {
"Documentation": "https://sty.mewo.dev/",
"Homepage": "https://sty.mewo.dev/",
"Repository": "https://github.com/feluxe/sty"
},
"split_keywords": [
"styling",
"color",
"colour",
"terminal",
"ansi",
"command",
"line",
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ec8922b3b7f25f67d04690e3b565ca89062a6e7afb1e7124342d5b5b22e8f014",
"md5": "80ade07dff9804a908bfd970a1aef1c7",
"sha256": "2b1eba187b3961644f797f97177f939c109c916d3d3a2cb6784454d1f1ce4983"
},
"downloads": -1,
"filename": "sty-1.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "80ade07dff9804a908bfd970a1aef1c7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 12553,
"upload_time": "2023-11-27T13:57:11",
"upload_time_iso_8601": "2023-11-27T13:57:11.400814Z",
"url": "https://files.pythonhosted.org/packages/ec/89/22b3b7f25f67d04690e3b565ca89062a6e7afb1e7124342d5b5b22e8f014/sty-1.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "766aaad1817e60f07e5ebc111affee15d4dff9d324981005310566c40f08786c",
"md5": "03aa57e78f0cad6322f1d801e987aca4",
"sha256": "d43ecb71b7bad0b56d622cb219d0be303c16fcb4143b84d1465ded22e29baa00"
},
"downloads": -1,
"filename": "sty-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "03aa57e78f0cad6322f1d801e987aca4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 12217,
"upload_time": "2023-11-27T13:57:12",
"upload_time_iso_8601": "2023-11-27T13:57:12.931279Z",
"url": "https://files.pythonhosted.org/packages/76/6a/aad1817e60f07e5ebc111affee15d4dff9d324981005310566c40f08786c/sty-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-27 13:57:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "feluxe",
"github_project": "sty",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "sty"
}