mirror of
https://github.com/NicklasVraa/Color-manager.git
synced 2026-03-18 21:50:34 +01:00
Fixed colors being mapped to below black.
This commit is contained in:
@@ -341,7 +341,7 @@ def apply_monotones_to_vec(text:str, colors:Set[str], hsl:Tuple[float,float,floa
|
||||
graytone = hex_to_gray(color)
|
||||
r, g, b = hex_to_rgb(graytone)
|
||||
l = (0.21*r + 0.72*g + 0.07*b)/255
|
||||
l = max(-1, min(l+l_offset, 1))
|
||||
l = max(0, min(l+l_offset, 1))
|
||||
monochrome = rgb_to_hex(hsl_to_rgb((h, s, l)))
|
||||
text = re.sub(color, monochrome, text)
|
||||
|
||||
@@ -388,7 +388,7 @@ def apply_monotones_to_img(img:Image, hsl:Tuple[float,float,float]) -> Image:
|
||||
r, g, b = img.getpixel((x, y))
|
||||
|
||||
l = (0.21*r + 0.72*g + 0.07*b)/255
|
||||
l = max(-1, min(l+l_offset, 1))
|
||||
l = max(0, min(l+l_offset, 1))
|
||||
new_color = hsl_to_rgb((h, s, l))
|
||||
|
||||
if mode == "RGBA":
|
||||
|
||||
87
test.ipynb
87
test.ipynb
@@ -2,9 +2,18 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"The autoreload extension is already loaded. To reload it, use:\n",
|
||||
" %reload_ext autoreload\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"%load_ext autoreload\n",
|
||||
"%autoreload 2\n",
|
||||
@@ -14,39 +23,39 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 52,
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"/home/nv/.themes/My_theme/index.theme\n"
|
||||
"/home/nv/.themes/My_theme_2/index.theme\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"svg: 100%|██████████| 84/84 [00:00<00:00, 365.25it/s]\n",
|
||||
"css: 100%|██████████| 27/27 [00:00<00:00, 83.93it/s]\n",
|
||||
"png: 100%|██████████| 442/442 [00:07<00:00, 57.79it/s] \n"
|
||||
"svg: 100%|██████████| 84/84 [00:00<00:00, 453.27it/s]\n",
|
||||
"css: 100%|██████████| 27/27 [00:00<00:00, 88.42it/s]\n",
|
||||
"png: 100%|██████████| 442/442 [00:07<00:00, 57.67it/s] \n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Generate theme pack.\n",
|
||||
"utils.recolor(\n",
|
||||
" \"~/Downloads/NovaOS-nord-theme\", # Source\n",
|
||||
" \"~/.themes\", # Destination\n",
|
||||
" \"My_theme\", # New name\n",
|
||||
" utils.norm_hsl(22, 35, 50)\n",
|
||||
" \"/opt/nova/theme/NovaOS-nord/\", # Source\n",
|
||||
" \"~/.themes\", # Destination\n",
|
||||
" \"My_theme_2\", # New name\n",
|
||||
" utils.norm_hsl(22, 25, 48)\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 54,
|
||||
"execution_count": 10,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -60,17 +69,17 @@
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"svg: 100%|██████████| 7974/7974 [00:01<00:00, 5569.24it/s]\n"
|
||||
"svg: 100%|██████████| 7974/7974 [00:01<00:00, 5775.11it/s]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# Generate icon pack.\n",
|
||||
"utils.recolor(\n",
|
||||
" \"~/Downloads/NovaOS-nord-icons\", # Source\n",
|
||||
" \"~/.icons\", # Destination\n",
|
||||
" \"My_icons\", # New name\n",
|
||||
" utils.norm_hsl(118, 26, 50)\n",
|
||||
" \"/opt/nova/icons/NovaOS-nord\", # Source\n",
|
||||
" \"~/.icons\", # Destination\n",
|
||||
" \"My_icons\", # New name\n",
|
||||
" utils.norm_hsl(118, 26, 55)\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
@@ -105,11 +114,51 @@
|
||||
"# Generate wallpaper pack.\n",
|
||||
"utils.recolor(\n",
|
||||
" \"~/Downloads/NovaOS-nord-wallpapers\", # Source\n",
|
||||
" \"~/.wallpapers\", # Destination\n",
|
||||
" \"My_wallpapers\", # New name\n",
|
||||
" \"~/.wallpapers\", # Destination\n",
|
||||
" \"My_wallpapers\", # New name\n",
|
||||
" utils.norm_hsl(0, 48, 65)\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'#0000000C'"
|
||||
]
|
||||
},
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"utils.css_to_hex(\"rgba(0, 0, 0, 0.05)\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"'rgba(0, 0, 0, 0.05)'"
|
||||
]
|
||||
},
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"utils.hex_to_css(\"#0000000C\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
Reference in New Issue
Block a user