khcolors


Namekhcolors JSON
Version 0.3.3 PyPI version JSON
download
home_pageNone
Summarycolour name choosing app, for rich and CSS4 palettes
upload_time2024-11-02 23:55:50
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords color colour css4 rich
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [//]: <> (pandoc README.md -f markdown -t html5 -s -o README.html)

# khcolors 🎨
## *Searching for colour names in terminal*

![Python version](https://img.shields.io/badge/Python-3.10-blue)
![Packaged with hatch](https://img.shields.io/badge/Packaged%20with-hatch-60c7a8)

`khcolors` is a terminal application for searching colour names.

<!-- [![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
[![Downloads Stats][npm-downloads]][npm-url] -->

## Table of Contents

- [Introduction](#introduction)
- [Installation](#installation)
- [Usage](#usage)
- [Known Issues](#known-issues)
- [Release History](#release-history)
- [License](#license)
- [Contact](#contact)
<!-- - [Acknowledgments](#acknowledgments) -->

## Introduction

<!-- One to two paragraph statement about your product and what it does. -->
The application helps choosing a colour name from `rich` or `CSS4` palettes. `khcolors` when given name, presents a list of all the colours containing the name; user can choose an index of a particular colour.

Sources for the colour names are `matplotlib.colors` and `rich.color.ANSI_COLOR_NAMES`. Thus the user can easily choose the appropriate colour shade, either working with `matplotlib`, or `rich`.

Searching for the colour name involves basic python data structures, lists and dictionaries, since datasets of all the colour names were considered small.

Since the application was designed as auxiliary tool, the command line interface was chosen, with minimalistic, though appealing, text formatting. Styling of the text was achieved mostly with the `rich` module; in one case ANSI codes were used.

A possibility of using/defining custom colour palettes is to be implemented in the future release.

- ## Installation

>   * Building locally

> > Clone \(`git clone https://github.com/pykhaz/khcolors.git`) or download the package \([github.com/pykhaz/khcolors](https://github.com/pykhaz/khcolors) → button/menu "Code" → "Download ZIP"), `cd` into `khcolors` and


> >     hatch build
> >     pip install .

>    - Installing from PyPI


 > >     pip install khcolors


## Usage

The easiest way to use the application is to type `khcolors` followed by the name of base colour, eg.

```bash
khcolors olive
```

All the colours containing the name given as the parameter, the base colour, are printed in the terminal, and user is asked to choose one. After confirming the choice, the colour name, or rgb triplet, are copied to clipboard and a confirmation message is displayed.

If the name of a palette is given as a parameter (currently two palettes are available: `base` and `base-bright`), the colours in the palette are displayed in the terminal and the user is asked to choose one.

Application options:

- `-c` / `--css` -- for using `matplotlib CSS4` palettes instead of `rich` (which is default),

- `-r` / `--rgb` -- for copying `(r, g, b)` tuple, instead of the name.

<!-- ![`khcolors` for colour `salmon`, cases for all the options (linux).](./assets/khcolors_salmon_x4_linux.png "This is the caption of the figure (a simple paragraph)."){ width=600px } -->

Screenshots:

<figure>
    <img src="./assets/khcolors_salmon_x4_linux.png" alt="`khcolors` for `salmon`" style="width:50%; height:auto;">
  <figcaption>khcolors for colour 'salmon', cases for all the options (linux).</figcaption>
</figure>

<br />

<figure>
    <img src="./assets/khcolors_salmon_x4_win11.png" alt="`khcolors` for `salmon`" style="width:50%; height:auto;">
  <figcaption>khcolors for colour 'salmon', cases for all the options (windows).</figcaption>
</figure>

<!-- [see file](./assets/outputfile_edited.html) -->

<!-- <figure> -->
<!--     <figcaption>khcolors, usage: on linux mint, in kitty</figcaption> -->
<!--     <img src="assets/khcolors_kitty.png" style="width: 50%;" title="usage: kitty linux" alt="image - usage: kitty linux" /> -->
<!-- </figure> -->

<!-- <br/> -->


<!-- <figure> -->
<!--     <figcaption>khcolors, usage: on windows, in powershell</figcaption> -->
<!--     <img src="assets/khcolors_powershell.png" style="width: 50%;" title="usage: powershell windows" alt="image - usage: powershell windows" /> -->
<!-- </figure> -->

<!--
## Development setup

Describe how to install all development dependencies and how to run an automated test-suite of some kind. Potentially do this for multiple platforms.

```sh
make install
npm test
```
-->

## Known issues

- Minimal terminal width -- as the width of the terminal grows smaller, the colour lines get messy. When the width drops below below 37 columns, a single colour line gets printed in two rows, which looks bad (but this is hardly a case, since the terminal window width is, in most cases, greater than 37 columns).

## Release History

- 0.3.3
  - updated README.md
- 0.3.2
  - new command line argument: `-r`/`--rgb` -- for copying `(r, g, b)` tuple,
      instead of the name; `-a`/`-all` removed
  - options for showing colors palette added: when `khcolors` called with
      the name of a palette (`base`, `base-bright`), the palette is shown
  - new file, `lib.py`; functions moved: `_get_rgb`, `_luminosity`, `byte_rgb`,
    `get_contrast_color`; vars: `LMN_CMPS`, `LMN_LT`, `COLOR_PALETTE`
  - `get_contrast_color`: new function for getting foreground/background colors
    right
  - 3 new functions carved out from `get_color_name`:
      `get_palette`, `get_color_choices`, `find_colors`
  - color tiles -- rows of colors printed -- remade completely
- 0.1.1
    - Minor change of the result message
- 0.1.0
    - First working version of the package
- 0.0.1
    - Work in progress

## License

The `khcolors` application is distributed under the MIT license. See [LICENSE](LICENSE.txt) for more information.

<!-- [https://github.com/heliotech](https://github.com/heliotech/) -->


<!-- Markdown link & img dfn's -->
<!--
[npm-image]: https://img.shields.io/npm/v/datadog-metrics.svg?style=flat-square
[npm-url]: https://npmjs.org/package/datadog-metrics
[npm-downloads]: https://img.shields.io/npm/dm/datadog-metrics.svg?style=flat-square
[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square
[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics
[wiki]: https://github.com/yourname/yourproject/wiki
-->

## Contact

<!--
khaz – [@YourTwitter](https://twitter.com/dbader_org) – YourEmail@example.com
-->
khaz –  pykhaz@o2.pl

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "khcolors",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "color, colour, css4, rich",
    "author": null,
    "author_email": "pykhaz <pykhaz@o2.pl>",
    "download_url": "https://files.pythonhosted.org/packages/fb/ec/e5766dfc942ca1cd73df33ecd33029916e0b00ab63e34a60f21f5c7b5e4f/khcolors-0.3.3.tar.gz",
    "platform": null,
    "description": "[//]: <> (pandoc README.md -f markdown -t html5 -s -o README.html)\n\n# khcolors \ud83c\udfa8\n## *Searching for colour names in terminal*\n\n![Python version](https://img.shields.io/badge/Python-3.10-blue)\n![Packaged with hatch](https://img.shields.io/badge/Packaged%20with-hatch-60c7a8)\n\n`khcolors` is a terminal application for searching colour names.\n\n<!-- [![NPM Version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Downloads Stats][npm-downloads]][npm-url] -->\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Known Issues](#known-issues)\n- [Release History](#release-history)\n- [License](#license)\n- [Contact](#contact)\n<!-- - [Acknowledgments](#acknowledgments) -->\n\n## Introduction\n\n<!-- One to two paragraph statement about your product and what it does. -->\nThe application helps choosing a colour name from `rich` or `CSS4` palettes. `khcolors` when given name, presents a list of all the colours containing the name; user can choose an index of a particular colour.\n\nSources for the colour names are `matplotlib.colors` and `rich.color.ANSI_COLOR_NAMES`. Thus the user can easily choose the appropriate colour shade, either working with `matplotlib`, or `rich`.\n\nSearching for the colour name involves basic python data structures, lists and dictionaries, since datasets of all the colour names were considered small.\n\nSince the application was designed as auxiliary tool, the command line interface was chosen, with minimalistic, though appealing, text formatting. Styling of the text was achieved mostly with the `rich` module; in one case ANSI codes were used.\n\nA possibility of using/defining custom colour palettes is to be implemented in the future release.\n\n- ## Installation\n\n>   * Building locally\n\n> > Clone \\(`git clone https://github.com/pykhaz/khcolors.git`) or download the package \\([github.com/pykhaz/khcolors](https://github.com/pykhaz/khcolors) \u2192 button/menu \"Code\" \u2192 \"Download ZIP\"), `cd` into `khcolors` and\n\n\n> >     hatch build\n> >     pip install .\n\n>    - Installing from PyPI\n\n\n > >     pip install khcolors\n\n\n## Usage\n\nThe easiest way to use the application is to type `khcolors` followed by the name of base colour, eg.\n\n```bash\nkhcolors olive\n```\n\nAll the colours containing the name given as the parameter, the base colour, are printed in the terminal, and user is asked to choose one. After confirming the choice, the colour name, or rgb triplet, are copied to clipboard and a confirmation message is displayed.\n\nIf the name of a palette is given as a parameter (currently two palettes are available: `base` and `base-bright`), the colours in the palette are displayed in the terminal and the user is asked to choose one.\n\nApplication options:\n\n- `-c` / `--css` -- for using `matplotlib CSS4` palettes instead of `rich` (which is default),\n\n- `-r` / `--rgb` -- for copying `(r, g, b)` tuple, instead of the name.\n\n<!-- ![`khcolors` for colour `salmon`, cases for all the options (linux).](./assets/khcolors_salmon_x4_linux.png \"This is the caption of the figure (a simple paragraph).\"){ width=600px } -->\n\nScreenshots:\n\n<figure>\n    <img src=\"./assets/khcolors_salmon_x4_linux.png\" alt=\"`khcolors` for `salmon`\" style=\"width:50%; height:auto;\">\n  <figcaption>khcolors for colour 'salmon', cases for all the options (linux).</figcaption>\n</figure>\n\n<br />\n\n<figure>\n    <img src=\"./assets/khcolors_salmon_x4_win11.png\" alt=\"`khcolors` for `salmon`\" style=\"width:50%; height:auto;\">\n  <figcaption>khcolors for colour 'salmon', cases for all the options (windows).</figcaption>\n</figure>\n\n<!-- [see file](./assets/outputfile_edited.html) -->\n\n<!-- <figure> -->\n<!--     <figcaption>khcolors, usage: on linux mint, in kitty</figcaption> -->\n<!--     <img src=\"assets/khcolors_kitty.png\" style=\"width: 50%;\" title=\"usage: kitty linux\" alt=\"image - usage: kitty linux\" /> -->\n<!-- </figure> -->\n\n<!-- <br/> -->\n\n\n<!-- <figure> -->\n<!--     <figcaption>khcolors, usage: on windows, in powershell</figcaption> -->\n<!--     <img src=\"assets/khcolors_powershell.png\" style=\"width: 50%;\" title=\"usage: powershell windows\" alt=\"image - usage: powershell windows\" /> -->\n<!-- </figure> -->\n\n<!--\n## Development setup\n\nDescribe how to install all development dependencies and how to run an automated test-suite of some kind. Potentially do this for multiple platforms.\n\n```sh\nmake install\nnpm test\n```\n-->\n\n## Known issues\n\n- Minimal terminal width -- as the width of the terminal grows smaller, the colour lines get messy. When the width drops below below 37 columns, a single colour line gets printed in two rows, which looks bad (but this is hardly a case, since the terminal window width is, in most cases, greater than 37 columns).\n\n## Release History\n\n- 0.3.3\n  - updated README.md\n- 0.3.2\n  - new command line argument: `-r`/`--rgb` -- for copying `(r, g, b)` tuple,\n      instead of the name; `-a`/`-all` removed\n  - options for showing colors palette added: when `khcolors` called with\n      the name of a palette (`base`, `base-bright`), the palette is shown\n  - new file, `lib.py`; functions moved: `_get_rgb`, `_luminosity`, `byte_rgb`,\n    `get_contrast_color`; vars: `LMN_CMPS`, `LMN_LT`, `COLOR_PALETTE`\n  - `get_contrast_color`: new function for getting foreground/background colors\n    right\n  - 3 new functions carved out from `get_color_name`:\n      `get_palette`, `get_color_choices`, `find_colors`\n  - color tiles -- rows of colors printed -- remade completely\n- 0.1.1\n    - Minor change of the result message\n- 0.1.0\n    - First working version of the package\n- 0.0.1\n    - Work in progress\n\n## License\n\nThe `khcolors` application is distributed under the MIT license. See [LICENSE](LICENSE.txt) for more information.\n\n<!-- [https://github.com/heliotech](https://github.com/heliotech/) -->\n\n\n<!-- Markdown link & img dfn's -->\n<!--\n[npm-image]: https://img.shields.io/npm/v/datadog-metrics.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/datadog-metrics\n[npm-downloads]: https://img.shields.io/npm/dm/datadog-metrics.svg?style=flat-square\n[travis-image]: https://img.shields.io/travis/dbader/node-datadog-metrics/master.svg?style=flat-square\n[travis-url]: https://travis-ci.org/dbader/node-datadog-metrics\n[wiki]: https://github.com/yourname/yourproject/wiki\n-->\n\n## Contact\n\n<!--\nkhaz \u2013 [@YourTwitter](https://twitter.com/dbader_org) \u2013 YourEmail@example.com\n-->\nkhaz \u2013  pykhaz@o2.pl\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "colour name choosing app, for rich and CSS4 palettes",
    "version": "0.3.3",
    "project_urls": {
        "Documentation": "https://github.com/pykhaz/khcolors#readme",
        "Homepage": "https://github.com/pykhaz/khcolors",
        "Issues": "https://github.com/pykhaz/khcolors/issues",
        "Source": "https://github.com/pykhaz/khcolors"
    },
    "split_keywords": [
        "color",
        " colour",
        " css4",
        " rich"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf69a54196b5d525cdd57debf4adbcdfe61b7481b8a260df3b9ef2c913262fb0",
                "md5": "e603890ccef6833a9135790a924b9c4a",
                "sha256": "f58ec771f1e9599f25bf149433acbd58030e86f0e21c0c9b1ac3b42c1e4b1507"
            },
            "downloads": -1,
            "filename": "khcolors-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e603890ccef6833a9135790a924b9c4a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11004,
            "upload_time": "2024-11-02T23:55:48",
            "upload_time_iso_8601": "2024-11-02T23:55:48.673387Z",
            "url": "https://files.pythonhosted.org/packages/cf/69/a54196b5d525cdd57debf4adbcdfe61b7481b8a260df3b9ef2c913262fb0/khcolors-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fbece5766dfc942ca1cd73df33ecd33029916e0b00ab63e34a60f21f5c7b5e4f",
                "md5": "fbfe9ee54f6769df8cda2ce37701142c",
                "sha256": "4ba398152b756de2c66ecd344bee5d8d64b6d6fedee7c524abffc1e2e75f1078"
            },
            "downloads": -1,
            "filename": "khcolors-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "fbfe9ee54f6769df8cda2ce37701142c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 4684,
            "upload_time": "2024-11-02T23:55:50",
            "upload_time_iso_8601": "2024-11-02T23:55:50.361408Z",
            "url": "https://files.pythonhosted.org/packages/fb/ec/e5766dfc942ca1cd73df33ecd33029916e0b00ab63e34a60f21f5c7b5e4f/khcolors-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-02 23:55:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pykhaz",
    "github_project": "khcolors#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "khcolors"
}
        
Elapsed time: 0.34047s