Files
Color-manager/test.ipynb
2023-08-20 23:00:52 +02:00

155 lines
3.8 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"svgs: 100%|██████████| 6/6 [00:00<00:00, 2730.07file/s]\n",
"pngs: 100%|██████████| 1/1 [00:05<00:00, 5.13s/file]\n",
"jpgs: 100%|██████████| 1/1 [00:04<00:00, 4.37s/file]\n",
"css': 0file [00:00, ?file/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, hsl) # Either hsl or palette"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from color_manager import utils\n",
"\n",
"image = \"test_pack/imgs/lake_cabin.png\" # Also try an svg.\n",
"num_colors = 10\n",
"output = \"resources/palette.png\" # Optional - saves colors as image.\n",
"\n",
"utils.extract_colors(image, num_colors, output)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from color_manager import utils\n",
"\n",
"svg_path = \"resources/icon.svg\"\n",
"save_path = \"resources/icon_cleaned.svg\" # Optional.\n",
"\n",
"utils.clean_svg(svg_path, save_path)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from color_manager import utils\n",
"\n",
"src = \"test_pack\"\n",
"name = \"my_pack\"\n",
"dest = \"~/Downloads\"\n",
"color = \"#000000\" # Optional - Defaults to black.\n",
"padding = 0 # Optional - Between backdrop and edge.\n",
"rounding = 0.5 # Optional - Between 0 and 1, i.e. rectangle and ellipse.\n",
"\n",
"utils.add_backdrop(src, dest, name, color, padding, rounding)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"rename called\n",
"/home/nv/Downloads/my_theme/index.theme\n",
"index.theme found\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"svg: 0file [00:00, ?file/s]\n",
"png: 0%| | 0/1 [00:00<?, ?file/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"png: 100%|██████████| 1/1 [00:00<00:00, 33.59file/s]\n",
"jpg: 0file [00:00, ?file/s]\n",
"css: 100%|██████████| 1/1 [00:00<00:00, 18.40file/s]\n"
]
}
],
"source": [
"from color_manager import utils\n",
"src = \"test_theme\"\n",
"name = \"my_theme\"\n",
"dest = \"~/Downloads\"\n",
"hsl = (0.6, 0.54, 0.5) # = rc.normalize_hsl(180, 50, 50)\n",
"palette = \"palettes/nord.json\"\n",
"\n",
"colors = utils.recolor(src, dest, name, hsl) # Either hsl or palette"
]
}
],
"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
}