colort


Namecolort JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryDisplay colored text in the terminal.
upload_time2023-08-09 13:06:09
maintainer
docs_urlNone
author
requires_python>=3
licenseMIT License Copyright (c) 2021 thep0y Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords color terminal
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <h1 align="center">Colort</h1>

<p align="center">
    <a href="https://pepy.tech/project/colort"><img alt="Downloads" src="https://static.pepy.tech/badge/colort"></a>    
    <a href="https://pepy.tech/project/colort"><img alt="Downloads" src="https://static.pepy.tech/badge/colort/month"></a>
    <a href="https://pepy.tech/project/colort"><img alt="Downloads" src="https://static.pepy.tech/badge/colort/week"></a>
</p>

This module provides functions for formatting text with ANSI escape codes to add color and style.

## Installation

```shell
pip install colort
```

## Usage

```python
from colort import colorize
```

The `colorize` function takes a string and any number of `Style` and `*Color` enums. It returns the string formatted with the specified styles.

For example:

```python
from colorformat import colorize, ForegroundColor as fc, Style

colored_text = colorize('Hello World!', fc.GREEN, Style.BOLD)
print("colored text: ", colored_text)
```

This will print the text in bold and green.

![截屏2023-08-06 11.03.47](https://s1.ax1x.com/2023/08/06/pPANNxs.png)

The available formatting options are:

### Colors

- ForegroundColor
  - BLACK, RED, GREEN, YELLOW, BLUE, etc.
- BackgroundColor
  - BLACK, RED, GREEN, YELLOW, BLUE, etc.

### Styles

- Style
  - NORMAL, BOLD, UNDERLINE, BLINK, INVERT, HIDE

Multiple styles can be combined:

```python
colorize('Text', ForegroundColor.WHITE, BackgroundColor.RED, Style.BOLD)
```


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "colort",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "color,terminal",
    "author": "",
    "author_email": "thep0y <thepoy@163.com>",
    "download_url": "https://files.pythonhosted.org/packages/0b/e8/15fcae7d476d41dc5745ddb3063eec1ea917cebbc18ee71af38e0b24efff/colort-1.0.1.tar.gz",
    "platform": null,
    "description": "<h1 align=\"center\">Colort</h1>\n\n<p align=\"center\">\n    <a href=\"https://pepy.tech/project/colort\"><img alt=\"Downloads\" src=\"https://static.pepy.tech/badge/colort\"></a>    \n    <a href=\"https://pepy.tech/project/colort\"><img alt=\"Downloads\" src=\"https://static.pepy.tech/badge/colort/month\"></a>\n    <a href=\"https://pepy.tech/project/colort\"><img alt=\"Downloads\" src=\"https://static.pepy.tech/badge/colort/week\"></a>\n</p>\n\nThis module provides functions for formatting text with ANSI escape codes to add color and style.\n\n## Installation\n\n```shell\npip install colort\n```\n\n## Usage\n\n```python\nfrom colort import colorize\n```\n\nThe `colorize` function takes a string and any number of `Style` and `*Color` enums. It returns the string formatted with the specified styles.\n\nFor example:\n\n```python\nfrom colorformat import colorize, ForegroundColor as fc, Style\n\ncolored_text = colorize('Hello World!', fc.GREEN, Style.BOLD)\nprint(\"colored text: \", colored_text)\n```\n\nThis will print the text in bold and green.\n\n![\u622a\u5c4f2023-08-06 11.03.47](https://s1.ax1x.com/2023/08/06/pPANNxs.png)\n\nThe available formatting options are:\n\n### Colors\n\n- ForegroundColor\n  - BLACK, RED, GREEN, YELLOW, BLUE, etc.\n- BackgroundColor\n  - BLACK, RED, GREEN, YELLOW, BLUE, etc.\n\n### Styles\n\n- Style\n  - NORMAL, BOLD, UNDERLINE, BLINK, INVERT, HIDE\n\nMultiple styles can be combined:\n\n```python\ncolorize('Text', ForegroundColor.WHITE, BackgroundColor.RED, Style.BOLD)\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2021 thep0y  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Display colored text in the terminal.",
    "version": "1.0.1",
    "project_urls": {
        "homepage": "https://github.com/thep0y/colort",
        "repository": "https://github.com/thep0y/colort"
    },
    "split_keywords": [
        "color",
        "terminal"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1744fc1d7efe39f7f9949cbef92a4c64d3ffd173fb2defa14bd18747e8200046",
                "md5": "979d92c385fe85a6134d3adad44ee0b5",
                "sha256": "f7d6bf78bb8515f9ba895da1687ed84590c161706f0ef6a23eb5aaaf352fcedc"
            },
            "downloads": -1,
            "filename": "colort-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "979d92c385fe85a6134d3adad44ee0b5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 4685,
            "upload_time": "2023-08-09T13:06:08",
            "upload_time_iso_8601": "2023-08-09T13:06:08.668966Z",
            "url": "https://files.pythonhosted.org/packages/17/44/fc1d7efe39f7f9949cbef92a4c64d3ffd173fb2defa14bd18747e8200046/colort-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0be815fcae7d476d41dc5745ddb3063eec1ea917cebbc18ee71af38e0b24efff",
                "md5": "904ffb4782e153e944a9337d24ff66a5",
                "sha256": "40c4f021a57c9133ce64118f5189a243afd8f3acf0f02d3d0bb61e4c5162b3c6"
            },
            "downloads": -1,
            "filename": "colort-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "904ffb4782e153e944a9337d24ff66a5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 5679,
            "upload_time": "2023-08-09T13:06:09",
            "upload_time_iso_8601": "2023-08-09T13:06:09.675446Z",
            "url": "https://files.pythonhosted.org/packages/0b/e8/15fcae7d476d41dc5745ddb3063eec1ea917cebbc18ee71af38e0b24efff/colort-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-09 13:06:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "thep0y",
    "github_project": "colort",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "colort"
}
        
Elapsed time: 0.09396s