Skip to content

Commit 2bb89a9

Browse files
committed
Merge branch 'dev' into testing
2 parents 21d1137 + ce27503 commit 2bb89a9

File tree

7 files changed

+739
-244
lines changed

7 files changed

+739
-244
lines changed

LICENSE

Lines changed: 674 additions & 201 deletions
Large diffs are not rendered by default.

PKGBUILD

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ pkgrel=1
55
pkgdesc="Automatic Material You Colors Generator from your wallpaper for the Plasma Desktop"
66
arch=('x86_64')
77
url="https://github.com/luisbocanegra/kde-material-you-colors"
8-
license=('APACHE')
9-
depends=("dbus-python" "python-numpy")
8+
license=('GPL3')
9+
depends=("dbus-python" "python-numpy" "python-pillow" "python-regex" "python-material-color-utilities")
1010
optdepends=('python-colr: colored hex codes printing'
1111
'python-pywal: theme other programs using Material You Colors'
1212
)
@@ -24,13 +24,8 @@ package() {
2424
install -Dm644 kde-material-you-colors.desktop ${pkgdir}/usr/lib/${pkgname}/kde-material-you-colors.desktop
2525
install -Dm644 sample_config.conf ${pkgdir}/usr/lib/${pkgname}/sample_config.conf
2626
install -Dm755 kde-material-you-colors ${pkgdir}/usr/lib/${pkgname}/kde-material-you-colors
27-
install -Dm755 utils.py ${pkgdir}/usr/lib/${pkgname}/utils.py
28-
install -Dm755 color_utils.py ${pkgdir}/usr/lib/${pkgname}/color_utils.py
29-
install -Dm755 schemeconfigs.py ${pkgdir}/usr/lib/${pkgname}/schemeconfigs.py
30-
install -Dm755 material-color-utility-bin ${pkgdir}/usr/lib/${pkgname}/material-color-utility-bin
31-
install -Dm755 libSkiaSharp.so ${pkgdir}/usr/lib/${pkgname}/libSkiaSharp.so
27+
find . -type f -name "*.py" -exec install -Dm755 {,${pkgdir}/usr/lib/${pkgname}/}{} \;
3228
install -dm755 ${pkgdir}/usr/bin
33-
ln -s /usr/lib/${pkgname}/material-color-utility-bin ${pkgdir}/usr/bin/material-color-utility
3429
ln -s /usr/lib/${pkgname}/kde-material-you-colors ${pkgdir}/usr/bin/kde-material-you-colors
3530
install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE
3631
}

color_utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,16 @@ def lighteen_color(hex_color, min, blend):
210210
# print(f"result after blend: {o}")
211211
return o
212212

213+
def scale_saturation(hex_color, amount):
214+
r, g, b = hex2rgb(hex_color)
215+
# convert rgb to hls
216+
h, s, v = colorsys.rgb_to_hsv(r, g, b)
217+
# manipulate value and convert back to rgb
218+
r, g, b = colorsys.hsv_to_rgb(h, amount, v)
219+
o_hex = rgb2hex(int(r), int(g), int(b))
220+
# print(f"scale_lightness color: {hex_color} * amount: {amount} = {o_hex}")
221+
return o_hex
222+
213223
# Tests
214224
if __name__ == '__main__':
215225
# Test color blend

install-fedora-based.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ fi;
1010

1111
echo -e "${BGreen}Installing dependencies${clean}"
1212
dnf update
13-
dnf install python3 python3-dbus python3-numpy
13+
dnf install python3 python3-dbus python3-numpy python3-pillow python3-pip
14+
15+
echo -e "${BGreen}Installing python PIP package material_color_utilities_python as user $SUDO_USER ${clean}"
16+
17+
sudo -u $SUDO_USER pip3 install monet/material_color_utilities_python-0.1.0-py3-none-any.whl
1418

1519
echo -e "${BGreen}Installing kde-material-you-colors${clean}"
1620
# Cleanup
@@ -19,8 +23,6 @@ rm -rf /usr/lib/${pkgname}
1923
mkdir -p /usr/lib/${pkgname}
2024
cp -f *.{py,conf,desktop} /usr/lib/${pkgname}/
2125
cp -f kde-material-you-colors /usr/lib/${pkgname}/kde-material-you-colors
22-
cp -f material-color-utility-bin /usr/lib/${pkgname}/material-color-utility-bin
23-
cp -f libSkiaSharp.so /usr/lib/${pkgname}/libSkiaSharp.so
2426
chmod 755 /usr/lib/${pkgname}/*.py
2527

2628
mkdir -p /usr/share/licenses/kde-material-you-colors/
@@ -29,7 +31,5 @@ chmod 664 /usr/share/licenses/${pkgname}/LICENSE
2931
chmod 664 /usr/lib/${pkgname}/*.{desktop,conf}
3032

3133
chmod 755 /usr/lib/${pkgname}/kde-material-you-colors
32-
chmod 755 /usr/lib/${pkgname}/material-color-utility-bin
33-
chmod 755 /usr/lib/${pkgname}/libSkiaSharp.so
3434
ln -sf /usr/lib/${pkgname}/kde-material-you-colors /usr/bin/kde-material-you-colors
35-
ln -sf /usr/lib/${pkgname}/material-color-utility-bin /usr/bin/material-color-utility
35+

install-ubuntu-based.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ fi;
1010

1111
echo -e "${BGreen}Installing dependencies${clean}"
1212
apt update
13-
apt install python3 python3-dbus python3-numpy
13+
apt install python3 python3-dbus python3-numpy python3-pillow python3-pip
14+
15+
echo -e "${BGreen}Installing python PIP package material_color_utilities_python as user $SUDO_USER ${clean}"
16+
17+
sudo -u $SUDO_USER pip3 install monet/material_color_utilities_python-0.1.0-py3-none-any.whl
1418

1519
echo -e "${BGreen}Installing kde-material-you-colors${clean}"
1620
# Cleanup
@@ -19,8 +23,6 @@ rm -rf /usr/lib/${pkgname}
1923
mkdir -p /usr/lib/${pkgname}
2024
cp -f *.{py,conf,desktop} /usr/lib/${pkgname}/
2125
cp -f kde-material-you-colors /usr/lib/${pkgname}/kde-material-you-colors
22-
cp -f material-color-utility-bin /usr/lib/${pkgname}/material-color-utility-bin
23-
cp -f libSkiaSharp.so /usr/lib/${pkgname}/libSkiaSharp.so
2426
chmod 755 /usr/lib/${pkgname}/*.py
2527

2628
mkdir -p /usr/share/licenses/kde-material-you-colors/
@@ -29,7 +31,4 @@ chmod 664 /usr/share/licenses/${pkgname}/LICENSE
2931
chmod 664 /usr/lib/${pkgname}/*.{desktop,conf}
3032

3133
chmod 755 /usr/lib/${pkgname}/kde-material-you-colors
32-
chmod 755 /usr/lib/${pkgname}/material-color-utility-bin
33-
chmod 755 /usr/lib/${pkgname}/libSkiaSharp.so
3434
ln -sf /usr/lib/${pkgname}/kde-material-you-colors /usr/bin/kde-material-you-colors
35-
ln -sf /usr/lib/${pkgname}/material-color-utility-bin /usr/bin/material-color-utility
Binary file not shown.

schemeconfigs.py

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from color_utils import blendColors, color_luminance, hex2rgb, hex2alpha, sort_colors_luminance, blend2contrast, lighteen_color
1+
from color_utils import blendColors, contrast_ratio, hex2rgb, hex2alpha, scale_saturation, sort_colors_luminance, blend2contrast, lighteen_color
22
from utils import range_check, tup2str
33
class ThemeConfig:
44
def __init__(self, colors, wallpaper_data, light_blend_multiplier=1, dark_blend_multiplier=1, toolbar_opacity=100):
@@ -83,7 +83,7 @@ def __init__(self, colors, wallpaper_data, light_blend_multiplier=1, dark_blend_
8383
for x in range(7):
8484
str_x = str(x)
8585
if (len(pywal_colors_dark) <= 7):
86-
if str_x in colors_best.keys(): #and color_luminance(colors_best[str_x])[1] > .15
86+
if str_x in colors_best.keys():
8787
c = lighteen_color(colors_best[str_x],.2,tones_neutral[99])
8888
pywal_colors_dark += (blend2contrast(c, pywal_colors_dark[0], tones_neutral[99], 4.5, .01, True),)
8989
else:
@@ -109,43 +109,61 @@ def __init__(self, colors, wallpaper_data, light_blend_multiplier=1, dark_blend_
109109
tones_neutral[99], sorted_colors[n], .85),)
110110

111111

112-
tone = 38
112+
tone = 50
113113
pywal_colors_light = (extras['SurfaceLight'],)
114114
pywal_colors_light_intense = (blendColors(
115-
tones_neutral[20], colors_light['secondary'], .6*lbm),)
115+
tones_neutral[20], colors_light['secondary'], .8*lbm),)
116116
pywal_colors_light_faint = (blendColors(
117-
tones_neutral[55], colors_light['secondary'], .6*lbm),)
117+
tones_neutral[55], colors_light['secondary'], .8*lbm),)
118+
119+
# for x in range(7):
120+
# str_x = str(x)
121+
# if str_x in colors_best.keys()and color_luminance(colors_best[str_x])[1] > .15: #and contrast_ratio(pywal_colors_light[0],colors_best[str_x]) > .8
122+
# pywal_colors_light += (blend2contrast(colors_best[str_x], pywal_colors_light[0], tones_neutral[20], 4.5, .01, False),)
123+
# else:
124+
# pywal_colors_light += (blend2contrast(tones_primary[tone], pywal_colors_light[0], tones_neutral[20], 4.5, .01, False),)
125+
# pywal_colors_light += (blend2contrast(tones_tertiary[tone], pywal_colors_light[0], tones_neutral[20], 4.5, .01, False),)
126+
# if tone < 91:
127+
# tone += 8
118128

119-
for x in range(best_colors_count):
129+
for x in range(7):
120130
str_x = str(x)
121-
if str_x in colors_best.keys()and color_luminance(colors_best[str_x])[1] > .15: #and contrast_ratio(pywal_colors_light[0],colors_best[str_x]) > .8
122-
pywal_colors_light += (blend2contrast(colors_best[str_x], pywal_colors_light[0], tones_neutral[20], 4.5, .01, False),)
131+
if (len(pywal_colors_light) <= 7):
132+
if str_x in colors_best.keys():
133+
c = scale_saturation(colors_best[str_x],1)
134+
pywal_colors_light += (blend2contrast(c, pywal_colors_light[0], tones_neutral[20], 3, .01, False),)
135+
else:
136+
if (len(pywal_colors_light) <= 7):
137+
c = scale_saturation(tones_primary[tone],1)
138+
pywal_colors_light += (blend2contrast(c, pywal_colors_light[0], tones_neutral[20], 3, .01, False),)
139+
if (len(pywal_colors_light) <= 7):
140+
c = scale_saturation(tones_tertiary[tone],1)
141+
pywal_colors_light += (blend2contrast(c, pywal_colors_light[0], tones_neutral[20], 3, .01, False),)
142+
if tone < 91:
143+
tone += 8
123144
else:
124-
pywal_colors_light += (blend2contrast(tones_primary[tone], pywal_colors_light[0], tones_neutral[20], 4.5, .01, False),)
125-
pywal_colors_light += (blend2contrast(tones_tertiary[tone], pywal_colors_light[0], tones_neutral[20], 4.5, .01, False),)
126-
if tone < 91:
127-
tone += 8
145+
break
128146

129147
all = pywal_colors_light
130148
pywal_colors_light = (pywal_colors_light[0],)
131-
sorted_colors = sort_colors_luminance(sort_colors_luminance(all,reverse=True)[-7:])
149+
sorted_colors = sort_colors_luminance(all,True)[-7:]
132150

133151
for n in range(len(sorted_colors)):
134152
pywal_colors_light_intense += (sorted_colors[n],)
135153
pywal_colors_light += (blendColors(
136-
tones_neutral[40], sorted_colors[n], .75*lbm),)
154+
tones_neutral[30], sorted_colors[n], .8*lbm),)
137155
pywal_colors_light_faint += (blendColors(
138-
tones_neutral[40], sorted_colors[n], .6*lbm),)
156+
tones_neutral[60], sorted_colors[n], .8*lbm),)
139157

140158

141-
''' print("CONTRAST CHECK DARK")
142-
for color in pywal_colors_dark:
143-
c = contrast_ratio(color, pywal_colors_dark[0])
144-
print(f"{color} - {c}")
145-
print("CONTRAST CHECK LIGHT")
146-
for color in pywal_colors_light:
147-
c = contrast_ratio(pywal_colors_light[0],color)
148-
print(f"{color} - {c}") '''
159+
# print("CONTRAST CHECK DARK")
160+
# for color in pywal_colors_dark:
161+
# c = contrast_ratio(color, pywal_colors_dark[0])
162+
# print(f"{color} - {c}")
163+
# print("CONTRAST CHECK LIGHT")
164+
# for color in pywal_colors_light:
165+
# c = contrast_ratio(pywal_colors_light[0],color)
166+
# print(f"{color} - {c}")
149167

150168
self._light_scheme = f"""[ColorEffects:Disabled]
151169
Color={extras['SurfaceLight1']}

0 commit comments

Comments
 (0)