Files
Color-manager/test.ipynb
2023-08-11 17:43:00 +02:00

105 lines
2.2 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processing svgs: 0%| | 0/6 [00:00<?, ?file/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Processing svgs: 100%|██████████| 6/6 [00:00<00:00, 84.43file/s]\n",
"Processing imgs: 100%|██████████| 2/2 [00:01<00:00, 1.27file/s]\n"
]
}
],
"source": [
"from color_manager import utils\n",
"\n",
"src = \"test_pack\"\n",
"name = \"my_pack\"\n",
"dest = \"~/Downloads\"\n",
"hsl = (0.6, 0.54, 0.5) # = rc.normalize_hsl(180, 50, 50)\n",
"palette = \"palettes/nord.json\"\n",
"\n",
"utils.recolor(src, dest, name, palette) # hsl or palette"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['#C0829C',\n",
" '#596996',\n",
" '#345D89',\n",
" '#284F81',\n",
" '#074C71',\n",
" '#213B6D',\n",
" '#0B385A',\n",
" '#053655',\n",
" '#013854',\n",
" '#012941']"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from color_manager import utils\n",
"\n",
"image = \"test_pack/imgs/lake_cabin.png\"\n",
"num_colors = 10\n",
"output = \"./palette.png\" # if given, saves colors as image.\n",
"\n",
"utils.extract_colors(image, num_colors, output)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "base",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}