couleur


Namecouleur JSON
Version 0.7.4 PyPI version JSON
download
home_pagehttp://github.com/gabrielfalcao/couleur
SummaryANSI terminal tool for python, colored shell and other handy fancy features
upload_time2020-03-09 21:40:15
maintainer
docs_urlNone
authorGabriel Falcao
requires_python
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            couleur - ANSI terminal tool for python, colored shell and other handy fancy features
=====================================================================================

**Couleur** is a handy tool to play around with ANSI features in a unix
terminal


.. image:: https://img.shields.io/pypi/dm/couleur
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/codecov/c/github/gabrielfalcao/couleur
   :target: https://codecov.io/gh/gabrielfalcao/couleur

.. image:: https://img.shields.io/github/workflow/status/gabrielfalcao/couleur/python-3.6?label=python%203.6
   :target: https://github.com/gabrielfalcao/couleur/actions

.. image:: https://img.shields.io/github/workflow/status/gabrielfalcao/couleur/python-3.7?label=python%203.7
   :target: https://github.com/gabrielfalcao/couleur/actions

.. image:: https://img.shields.io/readthedocs/couleur
   :target: https://couleur.readthedocs.io/

.. image:: https://img.shields.io/github/license/gabrielfalcao/couleur?label=Github%20License
   :target: https://github.com/gabrielfalcao/couleur/blob/master/COPYING

.. image:: https://img.shields.io/pypi/v/couleur
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/pypi/l/couleur?label=PyPi%20License
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/pypi/format/couleur
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/pypi/status/couleur
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/pypi/pyversions/couleur
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/pypi/implementation/couleur
   :target: https://pypi.org/project/couleur

.. image:: https://img.shields.io/snyk/vulnerabilities/github/gabrielfalcao/couleur
   :target: https://github.com/gabrielfalcao/couleur/network/alerts

.. image:: https://img.shields.io/github/v/tag/gabrielfalcao/couleur
   :target: https://github.com/gabrielfalcao/couleur/releases


installing
----------

::

   user@machine:~$ sudo pip install git+git://github.com/gabrielfalcao/couleur.git

features
--------

-  Single python file
-  100% tested
-  comes with syntax sugar

nutshell
--------

file-like objects filter
~~~~~~~~~~~~~~~~~~~~~~~~

.. figure:: http://gnu.gabrielfalcao.com/couleur_filter.png
   :alt: stdout filter

   stdout filter

further
^^^^^^^

.. code:: python

   import sys, couleur

   couleur.proxy(sys.stdout).enable()
   print "#{bold}#{blue}#{on:black}This is#{normal} a test"
   couleur.proxy(sys.stdout).ignore()

   print "#{green}#{on:black}This is#{normal} a test"
   couleur.proxy(sys.stdout).disable()

dynamic methods
~~~~~~~~~~~~~~~

couleur has a syntax sugar that is semantically nice:

.. code:: python

   print
   import couleur
   sh = couleur.Shell(indent=4)

   sh.bold_black_on_white('Nice highlight\n')
   # prints '\033[47m\033[1m\033[30mNice highlight\033[0m'

   sh.indent()
   # will increase a internal indentation factor in couleur.Shell instance

   sh.red('Just red\n')
   # prints indented as well '    \033[32mJust Green\033[0m\n'

   sh.dedent()

   # will decrease that indentation factor (above)

   # syntax sugar
   sh.green_and_normal_and_blue('this will be printed in green| and |this in blue\n')
   # see: '\033[32mthis will be printed in green\033[0m and \033[34mthis in blue\033[0m'

couleur can overwrite output, so that you can make things like printing
progress bars, show percentage and so on:

.. code:: python

   import time
   import couleur

   shell = couleur.Shell(linebreak=True, bold=True)

   for num in range(101):
       if num == 0:
           print

       shell.yellow_and_red("Downloading file: |%d%%" % num, replace=True)
       time.sleep(0.02)

   shell.white_and_green("Downloading file: |DONE!", replace=True)

Writing to other streams
^^^^^^^^^^^^^^^^^^^^^^^^

Simply pass the output as first argument of the ``Shell``

.. code:: python

   import couleur

   with open('output.log', 'w') as output:
       shell = couleur.Shell(output, linebreak=True, bold=True)
       shell.white_and_green("done with | Some task")

furthermore
~~~~~~~~~~~

With couleur you can mix modifiers and colors.

Available modifiers:

-  reset - resets from the current point to the end
-  bold - make text bold
-  blink - it may blink the text or make it slighly lighten, depending
   on the terminal
-  italic - make text italic
-  underline - add underline on text
-  inverse - invert colors
-  strikethrough - draws a line through the text
-  up - does the same than passing replace=True to the output function:
   carriage return and one line up

Available colors:

-  normal
-  black
-  red
-  green
-  yellow
-  blue
-  magenta
-  cyan
-  white

Example chaining modifiers:

.. code:: python

   import couleur

   shell = couleur.Shell(linebreak=True)
   shell.bold_italic_underline_green_on_black_and_italic_black_on_white("WOO| HOO")

free software
-------------

To contribute back with this project, all you need to do is write code,
and test code that proofs its functionallity

cloning and running tests
~~~~~~~~~~~~~~~~~~~~~~~~~

You will need to install
`nose <http://somethingaboutorange.com/mrl/projects/nose/0.11.3/>`__.

And run:

.. code:: shell

   user@machine:~/Projects$ git clone git://github.com/gabrielfalcao/couleur.git
   user@machine:~/Projects$ cd couleur
   user@machine:~/Projects/couleur$ make tests

nomenclature
------------

“couleur” stands for “color” in French, I like french, hence the name

Licensing
---------

::

   Copyright (c) 2010-2020 Gabriel Falcão
   Licensed under LGPLv3
   https://opensource.org/licenses/lgpl-3.0.html

`Bitdeli Badge <https://bitdeli.com/free>`__
            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/gabrielfalcao/couleur",
    "name": "couleur",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Gabriel Falcao",
    "author_email": "gabriel@nacaolivre.org",
    "download_url": "https://files.pythonhosted.org/packages/8a/c3/6aa454c63e55b28172c379aac286bb09a9dcc23c485518b37838c2f85781/couleur-0.7.4.tar.gz",
    "platform": "",
    "description": "couleur - ANSI terminal tool for python, colored shell and other handy fancy features\n=====================================================================================\n\n**Couleur** is a handy tool to play around with ANSI features in a unix\nterminal\n\n\n.. image:: https://img.shields.io/pypi/dm/couleur\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/codecov/c/github/gabrielfalcao/couleur\n   :target: https://codecov.io/gh/gabrielfalcao/couleur\n\n.. image:: https://img.shields.io/github/workflow/status/gabrielfalcao/couleur/python-3.6?label=python%203.6\n   :target: https://github.com/gabrielfalcao/couleur/actions\n\n.. image:: https://img.shields.io/github/workflow/status/gabrielfalcao/couleur/python-3.7?label=python%203.7\n   :target: https://github.com/gabrielfalcao/couleur/actions\n\n.. image:: https://img.shields.io/readthedocs/couleur\n   :target: https://couleur.readthedocs.io/\n\n.. image:: https://img.shields.io/github/license/gabrielfalcao/couleur?label=Github%20License\n   :target: https://github.com/gabrielfalcao/couleur/blob/master/COPYING\n\n.. image:: https://img.shields.io/pypi/v/couleur\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/pypi/l/couleur?label=PyPi%20License\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/pypi/format/couleur\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/pypi/status/couleur\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/pypi/pyversions/couleur\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/pypi/implementation/couleur\n   :target: https://pypi.org/project/couleur\n\n.. image:: https://img.shields.io/snyk/vulnerabilities/github/gabrielfalcao/couleur\n   :target: https://github.com/gabrielfalcao/couleur/network/alerts\n\n.. image:: https://img.shields.io/github/v/tag/gabrielfalcao/couleur\n   :target: https://github.com/gabrielfalcao/couleur/releases\n\n\ninstalling\n----------\n\n::\n\n   user@machine:~$ sudo pip install git+git://github.com/gabrielfalcao/couleur.git\n\nfeatures\n--------\n\n-  Single python file\n-  100% tested\n-  comes with syntax sugar\n\nnutshell\n--------\n\nfile-like objects filter\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. figure:: http://gnu.gabrielfalcao.com/couleur_filter.png\n   :alt: stdout filter\n\n   stdout filter\n\nfurther\n^^^^^^^\n\n.. code:: python\n\n   import sys, couleur\n\n   couleur.proxy(sys.stdout).enable()\n   print \"#{bold}#{blue}#{on:black}This is#{normal} a test\"\n   couleur.proxy(sys.stdout).ignore()\n\n   print \"#{green}#{on:black}This is#{normal} a test\"\n   couleur.proxy(sys.stdout).disable()\n\ndynamic methods\n~~~~~~~~~~~~~~~\n\ncouleur has a syntax sugar that is semantically nice:\n\n.. code:: python\n\n   print\n   import couleur\n   sh = couleur.Shell(indent=4)\n\n   sh.bold_black_on_white('Nice highlight\\n')\n   # prints '\\033[47m\\033[1m\\033[30mNice highlight\\033[0m'\n\n   sh.indent()\n   # will increase a internal indentation factor in couleur.Shell instance\n\n   sh.red('Just red\\n')\n   # prints indented as well '    \\033[32mJust Green\\033[0m\\n'\n\n   sh.dedent()\n\n   # will decrease that indentation factor (above)\n\n   # syntax sugar\n   sh.green_and_normal_and_blue('this will be printed in green| and |this in blue\\n')\n   # see: '\\033[32mthis will be printed in green\\033[0m and \\033[34mthis in blue\\033[0m'\n\ncouleur can overwrite output, so that you can make things like printing\nprogress bars, show percentage and so on:\n\n.. code:: python\n\n   import time\n   import couleur\n\n   shell = couleur.Shell(linebreak=True, bold=True)\n\n   for num in range(101):\n       if num == 0:\n           print\n\n       shell.yellow_and_red(\"Downloading file: |%d%%\" % num, replace=True)\n       time.sleep(0.02)\n\n   shell.white_and_green(\"Downloading file: |DONE!\", replace=True)\n\nWriting to other streams\n^^^^^^^^^^^^^^^^^^^^^^^^\n\nSimply pass the output as first argument of the ``Shell``\n\n.. code:: python\n\n   import couleur\n\n   with open('output.log', 'w') as output:\n       shell = couleur.Shell(output, linebreak=True, bold=True)\n       shell.white_and_green(\"done with | Some task\")\n\nfurthermore\n~~~~~~~~~~~\n\nWith couleur you can mix modifiers and colors.\n\nAvailable modifiers:\n\n-  reset - resets from the current point to the end\n-  bold - make text bold\n-  blink - it may blink the text or make it slighly lighten, depending\n   on the terminal\n-  italic - make text italic\n-  underline - add underline on text\n-  inverse - invert colors\n-  strikethrough - draws a line through the text\n-  up - does the same than passing replace=True to the output function:\n   carriage return and one line up\n\nAvailable colors:\n\n-  normal\n-  black\n-  red\n-  green\n-  yellow\n-  blue\n-  magenta\n-  cyan\n-  white\n\nExample chaining modifiers:\n\n.. code:: python\n\n   import couleur\n\n   shell = couleur.Shell(linebreak=True)\n   shell.bold_italic_underline_green_on_black_and_italic_black_on_white(\"WOO| HOO\")\n\nfree software\n-------------\n\nTo contribute back with this project, all you need to do is write code,\nand test code that proofs its functionallity\n\ncloning and running tests\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\nYou will need to install\n`nose <http://somethingaboutorange.com/mrl/projects/nose/0.11.3/>`__.\n\nAnd run:\n\n.. code:: shell\n\n   user@machine:~/Projects$ git clone git://github.com/gabrielfalcao/couleur.git\n   user@machine:~/Projects$ cd couleur\n   user@machine:~/Projects/couleur$ make tests\n\nnomenclature\n------------\n\n\u201ccouleur\u201d stands for \u201ccolor\u201d in French, I like french, hence the name\n\nLicensing\n---------\n\n::\n\n   Copyright (c) 2010-2020 Gabriel Falc\u00e3o\n   Licensed under LGPLv3\n   https://opensource.org/licenses/lgpl-3.0.html\n\n`Bitdeli Badge <https://bitdeli.com/free>`__",
    "bugtrack_url": null,
    "license": "",
    "summary": "ANSI terminal tool for python, colored shell and other handy fancy features",
    "version": "0.7.4",
    "project_urls": {
        "Homepage": "http://github.com/gabrielfalcao/couleur"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8ac36aa454c63e55b28172c379aac286bb09a9dcc23c485518b37838c2f85781",
                "md5": "9348a7063da176094441329a885de600",
                "sha256": "1e96a5972ecd5f88716fe4e4df63d31e85f57d3ff6c02a07e93a226a663961ba"
            },
            "downloads": -1,
            "filename": "couleur-0.7.4.tar.gz",
            "has_sig": false,
            "md5_digest": "9348a7063da176094441329a885de600",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6899,
            "upload_time": "2020-03-09T21:40:15",
            "upload_time_iso_8601": "2020-03-09T21:40:15.292468Z",
            "url": "https://files.pythonhosted.org/packages/8a/c3/6aa454c63e55b28172c379aac286bb09a9dcc23c485518b37838c2f85781/couleur-0.7.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-03-09 21:40:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gabrielfalcao",
    "github_project": "couleur",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "couleur"
}
        
Elapsed time: 0.21261s