simple-chalk


Namesimple-chalk JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/olsonpm/py_simple-chalk
SummaryA terminal string styling library
upload_time2018-11-24 18:34:12
maintainer
docs_urlNone
authorphil
requires_python>=3.6
licenseWTFNMFPL-1.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Simple Chalk

*Note: This document is best viewed [on github](github.com/olsonpm/py_simple-chalk).
Pypi's headers are all caps which presents inaccurate information*"


<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Intro](#intro)
   - [What is it?](#what-is-it)
   - [Why create it?](#why-create-it)
   - [Why the subset of features?](#why-the-subset-of-features)
- [Install](#install)
- [Usage](#usage)
- [Api](#api)
   - [`chalk` (string) => string](#chalk-string--string)
   - [`newChalk` () => Chalk](#newchalk---chalk)
- [Test](#test)
- [Features included from js version of Chalk](#features-included-from-js-version-of-chalk)
- [Features omitted](#features-omitted)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->


### Intro

##### What is it?

A terminal string styling library for python.  It implements a subset of
Sindre Sorhus' [chalk](https://github.com/chalk/chalk) (which is for js).

e.g. `chalk.green.bold("success")` prints like you'd expect in the console.

##### Why create it?

I am familiar with and enjoy the syntax of [chalk](https://github.com/chalk/chalk).
Anthonyalmarza's  [chalk](https://github.com/anthonyalmarza/chalk)
deviates from that syntax and so I created my own.

I'm also new to python so this was a good way to learn.


##### Why the subset of features?

I only use chalk for very simple purposes so I left out things like 256 colors.


### Install

```sh
$ pip install simple_chalk
```


### Usage

```python
from simple_chalk import chalk, green

# both of these are the same
print(chalk.green("success"))
print(green("success"))

# chained
print(green.bold("success"))

# assign combinations
success = green.bold.underline
print(success("we did it!"))

# last color wins
print(green.red("this is red"))

# background and foreground colors are separate
whyNot = green.bgWhite.red.bgGray
print(whyNot("this is red text with a gray background"))
```


### Api

`simple_chalk` exports the following

##### `chalk` (string) => string
 - A singleton that can be used instead of importing the colors and
   styles directly.
 - `chalk` and all exported colors/styles are chainable callables.  When called,
   they take a single string argument and return a string wrapped in the
   appropriate ascii color codes.

##### `newChalk` () => Chalk
 - You probably don't need this, but it creates a new chalk instance in case
   another library is misbehaving.

The following colors are exported

- black  
- red  
- green  
- yellow  
- blue  
- magenta  
- cyan  
- white  
- blackBright (also 'gray' and 'grey')
- redBright
- greenBright
- yellowBright
- blueBright
- magentaBright
- cyanBright
- whiteBright

Each color also has a camel-cased `bg` equivalent.  e.g. `bgBlack`
and `bgYellowBright`

Finally the following miscellaneous styles are exported

- bold
- dim
- underline
- hidden


### Test

```sh
hub clone olsonpm/py_simple-chalk
cd py_simple-chalk
python runTests.py
```


### Features included from js version of Chalk

- chainable api
- same color names (with added aliases)


### Features omitted

\*\* Features marked with `*` are ones I'd pull in should someone create a PR.

- 256 colors and TrueColor support
- multiple arguments, and thus nested styles
- \*color support detection
- \*blue -> blueBright auto conversion on windows
- \*ability to disable
- \*modifiers other than the miscellaneous styles noted above.
  e.g. `reset`, `italic`, `inverse` etc.
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/olsonpm/py_simple-chalk",
    "name": "simple-chalk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "",
    "author": "phil",
    "author_email": "philip.olson@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/31/97/b8114a347aee340570eb92b1a1fe512a038766903af7aa4e28447dc25c80/simple_chalk-0.1.0.tar.gz",
    "platform": "",
    "description": "## Simple Chalk\n\n*Note: This document is best viewed [on github](github.com/olsonpm/py_simple-chalk).\nPypi's headers are all caps which presents inaccurate information*\"\n\n\n<!-- START doctoc generated TOC please keep comment here to allow auto update -->\n<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->\n**Table of Contents**\n\n- [Intro](#intro)\n   - [What is it?](#what-is-it)\n   - [Why create it?](#why-create-it)\n   - [Why the subset of features?](#why-the-subset-of-features)\n- [Install](#install)\n- [Usage](#usage)\n- [Api](#api)\n   - [`chalk` (string) => string](#chalk-string--string)\n   - [`newChalk` () => Chalk](#newchalk---chalk)\n- [Test](#test)\n- [Features included from js version of Chalk](#features-included-from-js-version-of-chalk)\n- [Features omitted](#features-omitted)\n\n<!-- END doctoc generated TOC please keep comment here to allow auto update -->\n\n\n### Intro\n\n##### What is it?\n\nA terminal string styling library for python.  It implements a subset of\nSindre Sorhus' [chalk](https://github.com/chalk/chalk) (which is for js).\n\ne.g. `chalk.green.bold(\"success\")` prints like you'd expect in the console.\n\n##### Why create it?\n\nI am familiar with and enjoy the syntax of [chalk](https://github.com/chalk/chalk).\nAnthonyalmarza's  [chalk](https://github.com/anthonyalmarza/chalk)\ndeviates from that syntax and so I created my own.\n\nI'm also new to python so this was a good way to learn.\n\n\n##### Why the subset of features?\n\nI only use chalk for very simple purposes so I left out things like 256 colors.\n\n\n### Install\n\n```sh\n$ pip install simple_chalk\n```\n\n\n### Usage\n\n```python\nfrom simple_chalk import chalk, green\n\n# both of these are the same\nprint(chalk.green(\"success\"))\nprint(green(\"success\"))\n\n# chained\nprint(green.bold(\"success\"))\n\n# assign combinations\nsuccess = green.bold.underline\nprint(success(\"we did it!\"))\n\n# last color wins\nprint(green.red(\"this is red\"))\n\n# background and foreground colors are separate\nwhyNot = green.bgWhite.red.bgGray\nprint(whyNot(\"this is red text with a gray background\"))\n```\n\n\n### Api\n\n`simple_chalk` exports the following\n\n##### `chalk` (string) => string\n - A singleton that can be used instead of importing the colors and\n   styles directly.\n - `chalk` and all exported colors/styles are chainable callables.  When called,\n   they take a single string argument and return a string wrapped in the\n   appropriate ascii color codes.\n\n##### `newChalk` () => Chalk\n - You probably don't need this, but it creates a new chalk instance in case\n   another library is misbehaving.\n\nThe following colors are exported\n\n- black  \n- red  \n- green  \n- yellow  \n- blue  \n- magenta  \n- cyan  \n- white  \n- blackBright (also 'gray' and 'grey')\n- redBright\n- greenBright\n- yellowBright\n- blueBright\n- magentaBright\n- cyanBright\n- whiteBright\n\nEach color also has a camel-cased `bg` equivalent.  e.g. `bgBlack`\nand `bgYellowBright`\n\nFinally the following miscellaneous styles are exported\n\n- bold\n- dim\n- underline\n- hidden\n\n\n### Test\n\n```sh\nhub clone olsonpm/py_simple-chalk\ncd py_simple-chalk\npython runTests.py\n```\n\n\n### Features included from js version of Chalk\n\n- chainable api\n- same color names (with added aliases)\n\n\n### Features omitted\n\n\\*\\* Features marked with `*` are ones I'd pull in should someone create a PR.\n\n- 256 colors and TrueColor support\n- multiple arguments, and thus nested styles\n- \\*color support detection\n- \\*blue -> blueBright auto conversion on windows\n- \\*ability to disable\n- \\*modifiers other than the miscellaneous styles noted above.\n  e.g. `reset`, `italic`, `inverse` etc.",
    "bugtrack_url": null,
    "license": "WTFNMFPL-1.0",
    "summary": "A terminal string styling library",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/olsonpm/py_simple-chalk"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3197b8114a347aee340570eb92b1a1fe512a038766903af7aa4e28447dc25c80",
                "md5": "fb37dac10a85fa6be57f00b12ed72162",
                "sha256": "d80f55993dfa040c1b55d2fbfb925e4fbb5798c2934601aa448ef4a192d84196"
            },
            "downloads": -1,
            "filename": "simple_chalk-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fb37dac10a85fa6be57f00b12ed72162",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13862,
            "upload_time": "2018-11-24T18:34:12",
            "upload_time_iso_8601": "2018-11-24T18:34:12.103240Z",
            "url": "https://files.pythonhosted.org/packages/31/97/b8114a347aee340570eb92b1a1fe512a038766903af7aa4e28447dc25c80/simple_chalk-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2018-11-24 18:34:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "olsonpm",
    "github_project": "py_simple-chalk",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "simple-chalk"
}
        
Elapsed time: 0.45514s