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
2
2
from utils import range_check , tup2str
3
3
class ThemeConfig :
4
4
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_
83
83
for x in range (7 ):
84
84
str_x = str (x )
85
85
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 ():
87
87
c = lighteen_color (colors_best [str_x ],.2 ,tones_neutral [99 ])
88
88
pywal_colors_dark += (blend2contrast (c , pywal_colors_dark [0 ], tones_neutral [99 ], 4.5 , .01 , True ),)
89
89
else :
@@ -109,43 +109,61 @@ def __init__(self, colors, wallpaper_data, light_blend_multiplier=1, dark_blend_
109
109
tones_neutral [99 ], sorted_colors [n ], .85 ),)
110
110
111
111
112
- tone = 38
112
+ tone = 50
113
113
pywal_colors_light = (extras ['SurfaceLight' ],)
114
114
pywal_colors_light_intense = (blendColors (
115
- tones_neutral [20 ], colors_light ['secondary' ], .6 * lbm ),)
115
+ tones_neutral [20 ], colors_light ['secondary' ], .8 * lbm ),)
116
116
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
118
128
119
- for x in range (best_colors_count ):
129
+ for x in range (7 ):
120
130
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
123
144
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
128
146
129
147
all = pywal_colors_light
130
148
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 :]
132
150
133
151
for n in range (len (sorted_colors )):
134
152
pywal_colors_light_intense += (sorted_colors [n ],)
135
153
pywal_colors_light += (blendColors (
136
- tones_neutral [40 ], sorted_colors [n ], .75 * lbm ),)
154
+ tones_neutral [30 ], sorted_colors [n ], .8 * lbm ),)
137
155
pywal_colors_light_faint += (blendColors (
138
- tones_neutral [40 ], sorted_colors [n ], .6 * lbm ),)
156
+ tones_neutral [60 ], sorted_colors [n ], .8 * lbm ),)
139
157
140
158
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}")
149
167
150
168
self ._light_scheme = f"""[ColorEffects:Disabled]
151
169
Color={ extras ['SurfaceLight1' ]}
0 commit comments