moecolor


Namemoecolor JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/mhamdan91/moecolor
SummaryPython Libary to print colored and styled text in terminal. Offers color-specific configuration by providing 24bit hex or RGB values as well 256-color mode.
upload_time2023-12-01 03:42:54
maintainer
docs_urlNone
authormhamdan91 (Hamdan, Muhammad)
requires_python
license
keywords python color terminal text styling ansi coloring text text styling text formatting formatting
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Moecolor (Flexible terminal text coloring and styling)
=======================================================
## Table of Contents

 * [Overview](#overview)
 * [Library Installalion](#library-installalion)
 * [Library Usage](#library-usage)
 * [REMARKS](#remarks)


## Overview
This lightweight tool allows you to color terminal text and style it based on predefined attributes. The tool works very much like the `print` function.
Except it is a fancier `print` that you can do a lot more with to control text color and style.

## Library Installalion
To install the library simply run the following command in a cmd, shell or whatever...

```bash
# It's recommended to create a virtual environment

# Windows
pip install moecolor

# Linux
pip3 install moecolor
```

## Library usage?

### Example usage
The following examples shows how to print text in `green` in so many different ways:
```python
from moecolor import print
print('My example text as green', color='green')
print('My example text as green', color='grreenn') # This is obviously not green, but we got you.
print('My example text as green', color='#00FF00')
print('My example text as green', color=(0, 255, 0))
print('My example text as green', color=(10,))
print('My example text as green', color=10)
```

The following example shows how to underline, cross-out, bold, italize, a red text:
```python
from moecolor import print
print('My example text as green', color='red', attr=['bold', 'italic', 'strike', 'underline'])
```

Do you want more fine-grained control over your text? Sure, the following example prints per word coloring. It will print RED GREEN BLUE TEXT, using various colour configurations.
```python
from moecolor import print # This is an optional import, you can still use the original print function.
from moecolor import FormatText as ft
print("{} {} {}".format(ft('RED TEXT', color='#ff0000'), ft('GREEN TEXT', color='green'), ft('BLUE TEXT', color=12)))
```

### Usage Guidelines
The tool simply overloads the `print` function, so you can use it as a normal print and if you'd like to color and style text you can provide extra arguments.
The tool accepts the following arguments in addition to the kwargs accepted by the builtin `print` function.
- color
- attr
- usage

There are many options to choose from to color your text. You can:
- Choose a color string from a list of pre-defined colors ['BLACK', 'RED', 'GREEN', 'YELLOW', 'BLUE', 'MAGENTA', 'CYAN', 'BRIGHT_GRAY', 'DEFAULT', 'DARK_GRAY',
  'BRIGHT_RED', 'BRIGHT_GREEN', 'BRIGHT_YELLOW', 'BRIGHT_BLUE', 'BRIGHT_MAGENTA', 'BRIGHT_CYAN','WHITE', 'PURPLE', 'VOILET', 'LIME', 'ORANGE', 'RANDOM']
- If you wish to generate a random color, you can supply the word: 'RANDOM'.
- If you wish to pick a color from 256-color mode scale based on `https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit`, you can provide an integer between [0-255]
- If you wish to provide an RGB value for a specific 24-bit color, you provide a tuple/list of RGB values: (R, G, B) and numbers must be integers between [0-255]
- If you wish to provide a hex-code for an 24-bit RGB equivelent color, you can provide a string like `#FFFFFF`.

To style your text, you can use a set of pre-defined attributes:
- **'BOLD'**: **bold text** (synonymous options: 'b', 'bold', 'thick')
- **'DIM'**: dim text a little (synonymous options: 'dim', 'dark', 'd')
- **'ITALIC'**: *italize text* (synonymous options: 'i', 'italic')
- **'UNDERLINE'**: underline text, (synonymous options: 'u', 'underline')
- **'BLINK'**: make text blink at less than 150 times per minute (synonymous options: 'blink', 'blinking', 'flash')
- **'INVERT'**: invert text (synonymous options: 'reverse', 'invert', 'switch')
- **'HIDE'**: hide text from terminal (synonymous options: 'conceal', 'hide', 'invisible')
- **'STRIKE'**: ~~make text crossed-out~~, (synonymous options: 'crossed-out', 'cross-out', 'crossed-out', 'strike', 's')
- **'DOUBLE-UNDERLINE'**: underline text with double lines, (synonymous options: 'double-underline', '2u', 'uu', 'du')
- **'FOREGROUND'**: control foreground color [default behavior], (synonymous options: 'foreground', 'fg', 'fore-ground')
- **'BACKGROUND'**: control background color [to apply color the background instead of the foreground], (synonymous options: 'background' ,'bg', 'back-ground')
- **'OVERLINED'**: overline text (synonymous options: 'overlined', 'o', 'over-lined')
- **'UNDERLINE-COLOR'**: apply color to underlined text, used along with underlining, otherwise no effect (synonymous options: underline-color', 'ucolor', 'u-color', 'uc')
- **'CLEAR'**: clear screen, then print text. (synonymous options: 'reset', 'reset-position', 'clear', 'clear-screen')

To show tool usage, or this README, i.e., you supply the keyword `usage` or one of its synonymous ('h', 'usage', 'show_help', 'help_me', 'use') as follows:
```python
print(usage=True)
```
You can also display tool usage/docs using the following command:
```python
help(print)
```

### REMARKS

```python
# Note, all strings are case insensitive, so don't worry. Not just that, even if you misspell a color,
# we will guess it for you ;), just do NOT type `regrlue` and expect it to be blue for example,
# it might come up as green though.

"""
Some attributes may not be supported in all terminals. So, if a specific attribute does not work, that means the
terminal you are using does not support it.

Windows terminals (CMD, PS) support most of attributes, but the following ['blink', 'dim']
LINUX terminals support all AFAIK
"""
```

----------------------------------------
Author: Hamdan, Muhammad (@mhamdan91 - ©)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mhamdan91/moecolor",
    "name": "moecolor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,color,terminal,text,styling,ansi,coloring text,text styling,text formatting,formatting",
    "author": "mhamdan91 (Hamdan, Muhammad)",
    "author_email": "<mhamdan.dev@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/06/a9/eaf58d896185c8fe51da0550309db4a1c5534fb4d8aab860456d6b80f39f/moecolor-1.0.5.tar.gz",
    "platform": null,
    "description": "Moecolor (Flexible terminal text coloring and styling)\n=======================================================\n## Table of Contents\n\n * [Overview](#overview)\n * [Library Installalion](#library-installalion)\n * [Library Usage](#library-usage)\n * [REMARKS](#remarks)\n\n\n## Overview\nThis lightweight tool allows you to color terminal text and style it based on predefined attributes. The tool works very much like the `print` function.\nExcept it is a fancier `print` that you can do a lot more with to control text color and style.\n\n## Library Installalion\nTo install the library simply run the following command in a cmd, shell or whatever...\n\n```bash\n# It's recommended to create a virtual environment\n\n# Windows\npip install moecolor\n\n# Linux\npip3 install moecolor\n```\n\n## Library usage?\n\n### Example usage\nThe following examples shows how to print text in `green` in so many different ways:\n```python\nfrom moecolor import print\nprint('My example text as green', color='green')\nprint('My example text as green', color='grreenn') # This is obviously not green, but we got you.\nprint('My example text as green', color='#00FF00')\nprint('My example text as green', color=(0, 255, 0))\nprint('My example text as green', color=(10,))\nprint('My example text as green', color=10)\n```\n\nThe following example shows how to underline, cross-out, bold, italize, a red text:\n```python\nfrom moecolor import print\nprint('My example text as green', color='red', attr=['bold', 'italic', 'strike', 'underline'])\n```\n\nDo you want more fine-grained control over your text? Sure, the following example prints per word coloring. It will print RED GREEN BLUE TEXT, using various colour configurations.\n```python\nfrom moecolor import print # This is an optional import, you can still use the original print function.\nfrom moecolor import FormatText as ft\nprint(\"{} {} {}\".format(ft('RED TEXT', color='#ff0000'), ft('GREEN TEXT', color='green'), ft('BLUE TEXT', color=12)))\n```\n\n### Usage Guidelines\nThe tool simply overloads the `print` function, so you can use it as a normal print and if you'd like to color and style text you can provide extra arguments.\nThe tool accepts the following arguments in addition to the kwargs accepted by the builtin `print` function.\n- color\n- attr\n- usage\n\nThere are many options to choose from to color your text. You can:\n- Choose a color string from a list of pre-defined colors ['BLACK', 'RED', 'GREEN', 'YELLOW', 'BLUE', 'MAGENTA', 'CYAN', 'BRIGHT_GRAY', 'DEFAULT', 'DARK_GRAY',\n  'BRIGHT_RED', 'BRIGHT_GREEN', 'BRIGHT_YELLOW', 'BRIGHT_BLUE', 'BRIGHT_MAGENTA', 'BRIGHT_CYAN','WHITE', 'PURPLE', 'VOILET', 'LIME', 'ORANGE', 'RANDOM']\n- If you wish to generate a random color, you can supply the word: 'RANDOM'.\n- If you wish to pick a color from 256-color mode scale based on `https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit`, you can provide an integer between [0-255]\n- If you wish to provide an RGB value for a specific 24-bit color, you provide a tuple/list of RGB values: (R, G, B) and numbers must be integers between [0-255]\n- If you wish to provide a hex-code for an 24-bit RGB equivelent color, you can provide a string like `#FFFFFF`.\n\nTo style your text, you can use a set of pre-defined attributes:\n- **'BOLD'**: **bold text** (synonymous options: 'b', 'bold', 'thick')\n- **'DIM'**: dim text a little (synonymous options: 'dim', 'dark', 'd')\n- **'ITALIC'**: *italize text* (synonymous options: 'i', 'italic')\n- **'UNDERLINE'**: underline text, (synonymous options: 'u', 'underline')\n- **'BLINK'**: make text blink at less than 150 times per minute (synonymous options: 'blink', 'blinking', 'flash')\n- **'INVERT'**: invert text (synonymous options: 'reverse', 'invert', 'switch')\n- **'HIDE'**: hide text from terminal (synonymous options: 'conceal', 'hide', 'invisible')\n- **'STRIKE'**: ~~make text crossed-out~~, (synonymous options: 'crossed-out', 'cross-out', 'crossed-out', 'strike', 's')\n- **'DOUBLE-UNDERLINE'**: underline text with double lines, (synonymous options: 'double-underline', '2u', 'uu', 'du')\n- **'FOREGROUND'**: control foreground color [default behavior], (synonymous options: 'foreground', 'fg', 'fore-ground')\n- **'BACKGROUND'**: control background color [to apply color the background instead of the foreground], (synonymous options: 'background' ,'bg', 'back-ground')\n- **'OVERLINED'**: overline text (synonymous options: 'overlined', 'o', 'over-lined')\n- **'UNDERLINE-COLOR'**: apply color to underlined text, used along with underlining, otherwise no effect (synonymous options: underline-color', 'ucolor', 'u-color', 'uc')\n- **'CLEAR'**: clear screen, then print text. (synonymous options: 'reset', 'reset-position', 'clear', 'clear-screen')\n\nTo show tool usage, or this README, i.e., you supply the keyword `usage` or one of its synonymous ('h', 'usage', 'show_help', 'help_me', 'use') as follows:\n```python\nprint(usage=True)\n```\nYou can also display tool usage/docs using the following command:\n```python\nhelp(print)\n```\n\n### REMARKS\n\n```python\n# Note, all strings are case insensitive, so don't worry. Not just that, even if you misspell a color,\n# we will guess it for you ;), just do NOT type `regrlue` and expect it to be blue for example,\n# it might come up as green though.\n\n\"\"\"\nSome attributes may not be supported in all terminals. So, if a specific attribute does not work, that means the\nterminal you are using does not support it.\n\nWindows terminals (CMD, PS) support most of attributes, but the following ['blink', 'dim']\nLINUX terminals support all AFAIK\n\"\"\"\n```\n\n----------------------------------------\nAuthor: Hamdan, Muhammad (@mhamdan91 - \u00c2\u00a9)\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python Libary to print colored and styled text in terminal. Offers color-specific configuration by providing 24bit hex or RGB values as well 256-color mode.",
    "version": "1.0.5",
    "project_urls": {
        "Homepage": "https://github.com/mhamdan91/moecolor"
    },
    "split_keywords": [
        "python",
        "color",
        "terminal",
        "text",
        "styling",
        "ansi",
        "coloring text",
        "text styling",
        "text formatting",
        "formatting"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0faf850e75bfeb9cc4240482e3b74c9e82650be7f936d9531e9478411176fcc4",
                "md5": "33eef552b9457b16dc0f9cc9322f9617",
                "sha256": "b1c346a72f32cd35689ce30711732faa72a4c776e682eec444deed23f6b6ef41"
            },
            "downloads": -1,
            "filename": "moecolor-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "33eef552b9457b16dc0f9cc9322f9617",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 11114,
            "upload_time": "2023-12-01T03:42:52",
            "upload_time_iso_8601": "2023-12-01T03:42:52.974004Z",
            "url": "https://files.pythonhosted.org/packages/0f/af/850e75bfeb9cc4240482e3b74c9e82650be7f936d9531e9478411176fcc4/moecolor-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "06a9eaf58d896185c8fe51da0550309db4a1c5534fb4d8aab860456d6b80f39f",
                "md5": "65c2a66dd3979b030b83a6f0db69f16a",
                "sha256": "3b8c6f50040be06f61268eb10d53682520742f7f7496e818c9d3a8b411fe273d"
            },
            "downloads": -1,
            "filename": "moecolor-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "65c2a66dd3979b030b83a6f0db69f16a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8335,
            "upload_time": "2023-12-01T03:42:54",
            "upload_time_iso_8601": "2023-12-01T03:42:54.833555Z",
            "url": "https://files.pythonhosted.org/packages/06/a9/eaf58d896185c8fe51da0550309db4a1c5534fb4d8aab860456d6b80f39f/moecolor-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-01 03:42:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mhamdan91",
    "github_project": "moecolor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "moecolor"
}
        
Elapsed time: 0.15623s