kolorpack


Namekolorpack JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummaryPrint colored text in python
upload_time2023-12-17 09:54:58
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License
keywords ansi color text
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Installation

Use [pip](https://pip.pypa.io/en/stable/) to install kolorpack:

```bash
pip install kolorpack
```

## How To Print Colored Text

We can print text with a colored foreground:

```python
from kolorpack import fg

# Normal Colors
print(fg.red + "Red Text")
print(fg.green + "Green Text")
print(fg.blue + "Blue Text")

# Light Colors
print(fg.lightred + "Light Red Text")
print(fg.lightgreen + "Light Green Text")
print(fg.lightBlue + "Light Blue Text")
```

How it appears:

![Text with colored foreground](https://github.com/Samuel9360639/kolorpack/assets/153092961/5117e990-40fe-4b42-91b3-2525aff65d79)

We can also print text with a colored background:

```python
from kolorpack import bg

# Normal Colors
print(bg.red + "Red Background")
print(bg.green + "Green Background")
print(bg.blue + "Blue Background")

# Light Colors
print(bg.lightred + "Light Red Background")
print(bg.lightgreen + "Light Green Background")
print(bg.lightblue + "Light Blue Background")
```

How it appears:

![Text with colored background](https://github.com/Samuel9360639/kolorpack/assets/153092961/428f4c7a-a237-4045-b0ba-bf294266f9fe)

Available colors for fg and bg:

| Color                                                           | Name           |
|:---------------------------------------------------------------:|----------------|
| ![Black](https://placehold.co/15x15/000000/000000.png)          | black          |
| ![Red](https://placehold.co/15x15/800000/800000.png)            | red            |
| ![Green](https://placehold.co/15x15/008000/008000.png)          | green          |
| ![Yellow](https://placehold.co/15x15/808000/808000.png)         | yellow         |
| ![Blue](https://placehold.co/15x15/000080/000080.png)           | blue           |
| ![Magenta](https://placehold.co/15x15/800080/800080.png)        | magenta        |
| ![Cyan](https://placehold.co/15x15/008080/008080.png)           | cyan           |
| ![Grey](https://placehold.co/15x15/C0C0C0/C0C0C0.png)           | grey           |
| ![DarkGrey](https://placehold.co/15x15/808080/808080.png)       | darkgrey       |
| ![LightRed](https://placehold.co/15x15/FF0000/FF0000.png)       | lightred       |
| ![LightGreen](https://placehold.co/15x15/00FF00/00FF00.png)     | lightgreen     |
| ![LightYellow](https://placehold.co/15x15/FFFF00/FFFF00.png)    | lightyellow    |
| ![LightBlue](https://placehold.co/15x15/0000FF/0000FF.png)      | lightblue      |
| ![LightMagenta](https://placehold.co/15x15/FF00FF/FF00FF.png)   | lightmagenta   |
| ![LightCyan](https://placehold.co/15x15/00FFFF/00FFFF.png)      | lightcyan      |
| ![White](https://placehold.co/15x15/FFFFFF/FFFFFF.png)          | white          |

## How To Print Text Using Customized Colors

We can print using customized colors with Color Spaces RGB, HSL, HSV, Hex, CMYK:

```python
from kolorpack import fg, bg, reset

# Foreground Colors
print(fg.rgb(255, 0, 0) + "Red Text")
print(fg.hsl(30, 100, 50) + "Orange Text")
print(fg.hsv(60, 100, 100) + "Yellow Text")
print(fg.hex('#00FF00') + "Green Text")
print(fg.cmyk(100, 0, 0, 0) + "Cyan Text" + reset.fg)

# Background Colors
print(bg.rgb(255, 0, 0) + "Red Background")
print(bg.hsl(30, 100, 50) + "Orange Background")
print(bg.hsl(60, 100, 100) + "Yellow Background")
print(bg.hex('#00FF00') + "Green Background")
print(bg.cmyk(100, 0, 0, 0) + "Cyan Background" + reset.bg)
```

How it appears:

![Text with customized Colors](https://github.com/Samuel9360639/kolorpack/assets/153092961/337e22db-3292-4d0f-b016-123d55158cf7)

## How To Print Stylized Text

We can also print Stylized Text:

```python
from kolorpack import style

# Styles
print(style.bold + "Bold Text" + style.reset.bold)
print(style.underline + "Underlined Text" + style.reset.underline)
```

How it appears:

![Stylized text](https://github.com/Samuel9360639/kolorpack/assets/153092961/a5ea181c-cce8-46d9-9818-260f8f270772)

Available Styles:
    
    1. bold
    2. dim
    3. italic
    4. underline
    5. blink
    6. rapidblink
    7. reverse
    8. invisible
    9. strikethrough

Note: Some styles may not be supported in all terminals, and may have a different function.

## How To Use The Helper

### How To Check Color Model Values:

We can check whether HSL, HSV, Hex, CMYK and RGB Values are correct:

If the given color space values are correct, It will return True or else False.

```python
from kolorpack.helper import check

# Valid Values
print(check.rgb(255,128,0))
print(check.hsl(30, 100, 50))
print(check.hsv(30, 100, 100))
print(check.hex('#FF8000'))
print(check.cmyk(0, 50, 100, 0))

# Invalid Values
print(check.rgb(300,128,0))
print(check.hsl(400, 100, 50))
print(check.hsv(400, 100, 100))
print(check.hex('#ZZ8000'))
print(check.cmyk(0, 50, 200, 0))
```

The first five lines will return True as the given values are correct but the next five will return False as the given values are incorrect.

### Valid Color Model Ranges:

    RGB = R - (0, 255), G - (0, 255), B - (0, 255)
    HSL = H - (0.0, 360.0), S - (0.0, 100.0), L - (0.0, 100.0)
    HSV = H - (0.0, 360.0), S - (0.0, 100.0), V - (0.0, 100.0)
    Hex = Numbers 0 to 9 and Letters A to F with Length of 6 Characters
    CMYK = C - (0, 100), M - (0, 100), Y - (0, 100), K - (0, 100) 

### How To Convert Values Between Color Models:

We can convert HSL, HSV, Hex, CMYK to RGB and back:

```python
from kolorpack.helper import convert

# Color Models To RGB
print(convert.hsl_to_rgb(30, 100, 50))
print(convert.hsv_to_rgb(30, 100, 100))
print(convert.hex_to_rgb('#FF8000'))
print(convert.cmyk_to_rgb(0, 50, 100, 0))

# RGB To Color Models
print(convert.rgb_to_hsl(255, 0, 0))
print(convert.rgb_to_hsv(255, 128, 0))
print(convert.rgb_to_hex(255, 255, 0))
print(convert.rgb_to_cmyk(0, 255, 0))
```

Output:

![Convert color model values](https://github.com/Samuel9360639/kolorpack/assets/153092961/1ea577c3-bc85-4b9a-909f-70adc16de177)

## Thanks!

### Contribute

If you have any suggestions, create a pull request [here](https://github.com/Samuel9360639/kolorpack/pulls).

### Report Bugs 

If you find any bugs, please report them [here](https://github.com/Samuel9360639/kolorpack/issues).
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "kolorpack",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "ANSI,Color,Text",
    "author": "",
    "author_email": "Samuel <samuel.9360639@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/91/b5/4bdc9620cdf32ef5b9b6444b6e45c5d166dbb7940c644569586c5a55e757/kolorpack-0.0.1.tar.gz",
    "platform": null,
    "description": "## Installation\n\nUse [pip](https://pip.pypa.io/en/stable/) to install kolorpack:\n\n```bash\npip install kolorpack\n```\n\n## How To Print Colored Text\n\nWe can print text with a colored foreground:\n\n```python\nfrom kolorpack import fg\n\n# Normal Colors\nprint(fg.red + \"Red Text\")\nprint(fg.green + \"Green Text\")\nprint(fg.blue + \"Blue Text\")\n\n# Light Colors\nprint(fg.lightred + \"Light Red Text\")\nprint(fg.lightgreen + \"Light Green Text\")\nprint(fg.lightBlue + \"Light Blue Text\")\n```\n\nHow it appears:\n\n![Text with colored foreground](https://github.com/Samuel9360639/kolorpack/assets/153092961/5117e990-40fe-4b42-91b3-2525aff65d79)\n\nWe can also print text with a colored background:\n\n```python\nfrom kolorpack import bg\n\n# Normal Colors\nprint(bg.red + \"Red Background\")\nprint(bg.green + \"Green Background\")\nprint(bg.blue + \"Blue Background\")\n\n# Light Colors\nprint(bg.lightred + \"Light Red Background\")\nprint(bg.lightgreen + \"Light Green Background\")\nprint(bg.lightblue + \"Light Blue Background\")\n```\n\nHow it appears:\n\n![Text with colored background](https://github.com/Samuel9360639/kolorpack/assets/153092961/428f4c7a-a237-4045-b0ba-bf294266f9fe)\n\nAvailable colors for fg and bg:\n\n| Color                                                           | Name           |\n|:---------------------------------------------------------------:|----------------|\n| ![Black](https://placehold.co/15x15/000000/000000.png)          | black          |\n| ![Red](https://placehold.co/15x15/800000/800000.png)            | red            |\n| ![Green](https://placehold.co/15x15/008000/008000.png)          | green          |\n| ![Yellow](https://placehold.co/15x15/808000/808000.png)         | yellow         |\n| ![Blue](https://placehold.co/15x15/000080/000080.png)           | blue           |\n| ![Magenta](https://placehold.co/15x15/800080/800080.png)        | magenta        |\n| ![Cyan](https://placehold.co/15x15/008080/008080.png)           | cyan           |\n| ![Grey](https://placehold.co/15x15/C0C0C0/C0C0C0.png)           | grey           |\n| ![DarkGrey](https://placehold.co/15x15/808080/808080.png)       | darkgrey       |\n| ![LightRed](https://placehold.co/15x15/FF0000/FF0000.png)       | lightred       |\n| ![LightGreen](https://placehold.co/15x15/00FF00/00FF00.png)     | lightgreen     |\n| ![LightYellow](https://placehold.co/15x15/FFFF00/FFFF00.png)    | lightyellow    |\n| ![LightBlue](https://placehold.co/15x15/0000FF/0000FF.png)      | lightblue      |\n| ![LightMagenta](https://placehold.co/15x15/FF00FF/FF00FF.png)   | lightmagenta   |\n| ![LightCyan](https://placehold.co/15x15/00FFFF/00FFFF.png)      | lightcyan      |\n| ![White](https://placehold.co/15x15/FFFFFF/FFFFFF.png)          | white          |\n\n## How To Print Text Using Customized Colors\n\nWe can print using customized colors with Color Spaces RGB, HSL, HSV, Hex, CMYK:\n\n```python\nfrom kolorpack import fg, bg, reset\n\n# Foreground Colors\nprint(fg.rgb(255, 0, 0) + \"Red Text\")\nprint(fg.hsl(30, 100, 50) + \"Orange Text\")\nprint(fg.hsv(60, 100, 100) + \"Yellow Text\")\nprint(fg.hex('#00FF00') + \"Green Text\")\nprint(fg.cmyk(100, 0, 0, 0) + \"Cyan Text\" + reset.fg)\n\n# Background Colors\nprint(bg.rgb(255, 0, 0) + \"Red Background\")\nprint(bg.hsl(30, 100, 50) + \"Orange Background\")\nprint(bg.hsl(60, 100, 100) + \"Yellow Background\")\nprint(bg.hex('#00FF00') + \"Green Background\")\nprint(bg.cmyk(100, 0, 0, 0) + \"Cyan Background\" + reset.bg)\n```\n\nHow it appears:\n\n![Text with customized Colors](https://github.com/Samuel9360639/kolorpack/assets/153092961/337e22db-3292-4d0f-b016-123d55158cf7)\n\n## How To Print Stylized Text\n\nWe can also print Stylized Text:\n\n```python\nfrom kolorpack import style\n\n# Styles\nprint(style.bold + \"Bold Text\" + style.reset.bold)\nprint(style.underline + \"Underlined Text\" + style.reset.underline)\n```\n\nHow it appears:\n\n![Stylized text](https://github.com/Samuel9360639/kolorpack/assets/153092961/a5ea181c-cce8-46d9-9818-260f8f270772)\n\nAvailable Styles:\n    \n    1. bold\n    2. dim\n    3. italic\n    4. underline\n    5. blink\n    6. rapidblink\n    7. reverse\n    8. invisible\n    9. strikethrough\n\nNote: Some styles may not be supported in all terminals, and may have a different function.\n\n## How To Use The Helper\n\n### How To Check Color Model Values:\n\nWe can check whether HSL, HSV, Hex, CMYK and RGB Values are correct:\n\nIf the given color space values are correct, It will return True or else False.\n\n```python\nfrom kolorpack.helper import check\n\n# Valid Values\nprint(check.rgb(255,128,0))\nprint(check.hsl(30, 100, 50))\nprint(check.hsv(30, 100, 100))\nprint(check.hex('#FF8000'))\nprint(check.cmyk(0, 50, 100, 0))\n\n# Invalid Values\nprint(check.rgb(300,128,0))\nprint(check.hsl(400, 100, 50))\nprint(check.hsv(400, 100, 100))\nprint(check.hex('#ZZ8000'))\nprint(check.cmyk(0, 50, 200, 0))\n```\n\nThe first five lines will return True as the given values are correct but the next five will return False as the given values are incorrect.\n\n### Valid Color Model Ranges:\n\n    RGB = R - (0, 255), G - (0, 255), B - (0, 255)\n    HSL = H - (0.0, 360.0), S - (0.0, 100.0), L - (0.0, 100.0)\n    HSV = H - (0.0, 360.0), S - (0.0, 100.0), V - (0.0, 100.0)\n    Hex = Numbers 0 to 9 and Letters A to F with Length of 6 Characters\n    CMYK = C - (0, 100), M - (0, 100), Y - (0, 100), K - (0, 100) \n\n### How To Convert Values Between Color Models:\n\nWe can convert HSL, HSV, Hex, CMYK to RGB and back:\n\n```python\nfrom kolorpack.helper import convert\n\n# Color Models To RGB\nprint(convert.hsl_to_rgb(30, 100, 50))\nprint(convert.hsv_to_rgb(30, 100, 100))\nprint(convert.hex_to_rgb('#FF8000'))\nprint(convert.cmyk_to_rgb(0, 50, 100, 0))\n\n# RGB To Color Models\nprint(convert.rgb_to_hsl(255, 0, 0))\nprint(convert.rgb_to_hsv(255, 128, 0))\nprint(convert.rgb_to_hex(255, 255, 0))\nprint(convert.rgb_to_cmyk(0, 255, 0))\n```\n\nOutput:\n\n![Convert color model values](https://github.com/Samuel9360639/kolorpack/assets/153092961/1ea577c3-bc85-4b9a-909f-70adc16de177)\n\n## Thanks!\n\n### Contribute\n\nIf you have any suggestions, create a pull request [here](https://github.com/Samuel9360639/kolorpack/pulls).\n\n### Report Bugs \n\nIf you find any bugs, please report them [here](https://github.com/Samuel9360639/kolorpack/issues).",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Print colored text in python",
    "version": "0.0.1",
    "project_urls": {
        "Contribute": "https://github.com/Samuel9360639/kolorpack/pulls",
        "Homepage": "https://github.com/Samuel9360639/kolorpack",
        "Issues": "https://github.com/Samuel9360639/kolorpack/issues"
    },
    "split_keywords": [
        "ansi",
        "color",
        "text"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ded38ec8d3c7f03949c1cee150ed94c6b4fe9fd1247b5fa40d9f65b7b16fd606",
                "md5": "9f90644990954dd51882bdc42ffcd147",
                "sha256": "da8efd2943c7b643f61684571cf05086277574e992d8561b9e7a4cdd24cce8c1"
            },
            "downloads": -1,
            "filename": "kolorpack-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9f90644990954dd51882bdc42ffcd147",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 3704,
            "upload_time": "2023-12-17T09:54:56",
            "upload_time_iso_8601": "2023-12-17T09:54:56.599755Z",
            "url": "https://files.pythonhosted.org/packages/de/d3/8ec8d3c7f03949c1cee150ed94c6b4fe9fd1247b5fa40d9f65b7b16fd606/kolorpack-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "91b54bdc9620cdf32ef5b9b6444b6e45c5d166dbb7940c644569586c5a55e757",
                "md5": "92c4dc5c8c40e914dfad1fea4e6e7c28",
                "sha256": "9410ed55eaebc59acd5aa9685f855266e3824e8fc850f5c6423956feeb19564d"
            },
            "downloads": -1,
            "filename": "kolorpack-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "92c4dc5c8c40e914dfad1fea4e6e7c28",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7277,
            "upload_time": "2023-12-17T09:54:58",
            "upload_time_iso_8601": "2023-12-17T09:54:58.739855Z",
            "url": "https://files.pythonhosted.org/packages/91/b5/4bdc9620cdf32ef5b9b6444b6e45c5d166dbb7940c644569586c5a55e757/kolorpack-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-17 09:54:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Samuel9360639",
    "github_project": "kolorpack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "kolorpack"
}
        
Elapsed time: 2.77588s