# Calculates the closest colors from 2 lists
```python
pip install a-pandas-ex-closest-color
```
```python
from a_pandas_ex_closest_color import pd_add_closest_color
import pandas as pd
pd_add_closest_color()
colorlist = [
(0, 0, 0), # black
(230, 25, 75), # red
(60, 180, 75), # green
(255, 225, 25), # yellow
(0, 130, 200), # blue
(245, 130, 48), # orange
(145, 30, 180), # purple
(70, 240, 240), # cyan
(240, 50, 230), # magenta
(210, 245, 60), # lime
(250, 190, 190), # pink
(0, 128, 128), # teal
(230, 190, 255), # lavender
(170, 110, 40), # brown
(255, 250, 200), # beige
(128, 0, 0), # maroon
(170, 255, 195), # mint
(128, 128, 0), # olive
(255, 215, 180), # coral
(0, 0, 128), # navy
(128, 128, 128), # grey
(255, 255, 255), # white
(115, 12, 37), # dark red
(30, 90, 37), # dark green
(127, 112, 12), # dark yellow
(0, 65, 100), # dark blue
(122, 65, 24), # dark orange
(72, 15, 90), # dark purple
(35, 120, 120), # dark cyan
(120, 25, 115), # dark magenta
(105, 122, 30), # dark lime
(125, 95, 95), # dark pink
(0, 64, 64), # dark teal
(115, 95, 127), # dark lavender
(85, 55, 20), # dark brown
(127, 125, 100), # dark beige
(64, 0, 0), # dark maroon
(85, 127, 97), # dark mint
(64, 64, 0), # dark olive
(127, 107, 90), # dark coral
(0, 0, 64), # dark navy
(64, 64, 64), # dark grey
]
wanted_colors = [(255, 0, 0), (255, 255, 0), (0, 0, 0)]
df = pd.Q_find_closest_color(wanted_colors=wanted_colors,colorlist=colorlist)
print(df)
r g b rating rgb
0 230 25 75 82.9375 (255, 0, 0)
1 128 0 0 127.0000 (255, 0, 0)
2 245 130 48 139.0000 (255, 0, 0)
3 170 110 40 144.6250 (255, 0, 0)
4 115 12 37 145.2500 (255, 0, 0)
.. ... ... ... ... ...
121 250 190 190 367.0000 (0, 0, 0)
122 255 215 180 379.0000 (0, 0, 0)
123 230 190 255 392.5000 (0, 0, 0)
124 255 250 200 409.2500 (0, 0, 0)
125 255 255 255 441.7500 (0, 0, 0)
[126 rows x 5 columns]
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/a_pandas_ex_closest_color",
"name": "a-pandas-ex-closest-color",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pandas,DataFrame,colors,rgb,numpy",
"author": "Johannes Fischer",
"author_email": "<aulasparticularesdealemaosp@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/9f/cb/0e7998e09b80719479e38175686d4aa962866f967a78d5c7ad27b6a5be7f/a_pandas_ex_closest_color-0.10.tar.gz",
"platform": null,
"description": "\n# Calculates the closest colors from 2 lists\n\n\n\n```python\n\npip install a-pandas-ex-closest-color\n\n```\n\n\n\n```python\n\n\n\nfrom a_pandas_ex_closest_color import pd_add_closest_color\n\nimport pandas as pd\n\npd_add_closest_color()\n\n\n\ncolorlist = [\n\n (0, 0, 0), # black\n\n (230, 25, 75), # red\n\n (60, 180, 75), # green\n\n (255, 225, 25), # yellow\n\n (0, 130, 200), # blue\n\n (245, 130, 48), # orange\n\n (145, 30, 180), # purple\n\n (70, 240, 240), # cyan\n\n (240, 50, 230), # magenta\n\n (210, 245, 60), # lime\n\n (250, 190, 190), # pink\n\n (0, 128, 128), # teal\n\n (230, 190, 255), # lavender\n\n (170, 110, 40), # brown\n\n (255, 250, 200), # beige\n\n (128, 0, 0), # maroon\n\n (170, 255, 195), # mint\n\n (128, 128, 0), # olive\n\n (255, 215, 180), # coral\n\n (0, 0, 128), # navy\n\n (128, 128, 128), # grey\n\n (255, 255, 255), # white\n\n (115, 12, 37), # dark red\n\n (30, 90, 37), # dark green\n\n (127, 112, 12), # dark yellow\n\n (0, 65, 100), # dark blue\n\n (122, 65, 24), # dark orange\n\n (72, 15, 90), # dark purple\n\n (35, 120, 120), # dark cyan\n\n (120, 25, 115), # dark magenta\n\n (105, 122, 30), # dark lime\n\n (125, 95, 95), # dark pink\n\n (0, 64, 64), # dark teal\n\n (115, 95, 127), # dark lavender\n\n (85, 55, 20), # dark brown\n\n (127, 125, 100), # dark beige\n\n (64, 0, 0), # dark maroon\n\n (85, 127, 97), # dark mint\n\n (64, 64, 0), # dark olive\n\n (127, 107, 90), # dark coral\n\n (0, 0, 64), # dark navy\n\n (64, 64, 64), # dark grey\n\n]\n\nwanted_colors = [(255, 0, 0), (255, 255, 0), (0, 0, 0)]\n\ndf = pd.Q_find_closest_color(wanted_colors=wanted_colors,colorlist=colorlist)\n\nprint(df)\n\n\n\n\n\n r g b rating rgb\n\n0 230 25 75 82.9375 (255, 0, 0)\n\n1 128 0 0 127.0000 (255, 0, 0)\n\n2 245 130 48 139.0000 (255, 0, 0)\n\n3 170 110 40 144.6250 (255, 0, 0)\n\n4 115 12 37 145.2500 (255, 0, 0)\n\n.. ... ... ... ... ...\n\n121 250 190 190 367.0000 (0, 0, 0)\n\n122 255 215 180 379.0000 (0, 0, 0)\n\n123 230 190 255 392.5000 (0, 0, 0)\n\n124 255 250 200 409.2500 (0, 0, 0)\n\n125 255 255 255 441.7500 (0, 0, 0)\n\n[126 rows x 5 columns]\n\n\n\n\n\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Calculates the closest colors from 2 lists",
"version": "0.10",
"split_keywords": [
"pandas",
"dataframe",
"colors",
"rgb",
"numpy"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "5cd154a6b70d96d1afa7a271619e9205",
"sha256": "f21011d0cd0ad43008a7701c00ee924e337ae34450df9cbbe7b9211628b66982"
},
"downloads": -1,
"filename": "a_pandas_ex_closest_color-0.10-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5cd154a6b70d96d1afa7a271619e9205",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 6382,
"upload_time": "2022-12-18T12:34:12",
"upload_time_iso_8601": "2022-12-18T12:34:12.407320Z",
"url": "https://files.pythonhosted.org/packages/ef/0b/6b644ddf7e3e3959844d33ff6dc2a30c6502f249f4476ba9886b9c1680cc/a_pandas_ex_closest_color-0.10-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "54b0669d66f617d1c4cb63c556581e64",
"sha256": "895225f015defd38d7e08eae5ff2dbb644f28428f3ae7932e339380e598ac91a"
},
"downloads": -1,
"filename": "a_pandas_ex_closest_color-0.10.tar.gz",
"has_sig": false,
"md5_digest": "54b0669d66f617d1c4cb63c556581e64",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4588,
"upload_time": "2022-12-18T12:34:13",
"upload_time_iso_8601": "2022-12-18T12:34:13.861781Z",
"url": "https://files.pythonhosted.org/packages/9f/cb/0e7998e09b80719479e38175686d4aa962866f967a78d5c7ad27b6a5be7f/a_pandas_ex_closest_color-0.10.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-18 12:34:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "hansalemaos",
"github_project": "a_pandas_ex_closest_color",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "a_pandas_ex_obj_into_cell",
"specs": []
},
{
"name": "a_pandas_ex_to_tuple",
"specs": []
},
{
"name": "numexpr",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "pandas",
"specs": []
}
],
"lcname": "a-pandas-ex-closest-color"
}