mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-01-24 23:09:16 +01:00
colors: better sort and better white by blending.
This commit is contained in:
parent
b9d6eb8914
commit
e06f53dc96
@ -1,5 +1,5 @@
|
|||||||
[BASIC]
|
[BASIC]
|
||||||
good-names=i,j,k,n,x,y,fg,bg,r,g,b,i3
|
good-names=i,j,k,n,x,y,fg,bg,r,g,b,i3,r1,r2,r3,g1,g2,g3,b1,b2,b3
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
# inconsistent-return-statements:
|
# inconsistent-return-statements:
|
||||||
|
@ -59,16 +59,16 @@ def gen_colors(img, color_count):
|
|||||||
def create_palette(img, colors):
|
def create_palette(img, colors):
|
||||||
"""Sort the generated colors and store them in a dict that
|
"""Sort the generated colors and store them in a dict that
|
||||||
we will later save in json format."""
|
we will later save in json format."""
|
||||||
raw_colors = colors[:1] + colors[8:] + colors[8:-1]
|
raw_colors = colors[:1] + colors[8:16] + colors[8:-1]
|
||||||
|
|
||||||
# Darken the background color slightly.
|
# Darken the background color slightly.
|
||||||
if raw_colors[0][1] != "0":
|
if raw_colors[0][1] != "0":
|
||||||
raw_colors[0] = util.darken_color(raw_colors[0], 0.25)
|
raw_colors[0] = util.darken_color(raw_colors[0], 0.25)
|
||||||
|
|
||||||
# Manually adjust colors.
|
# Manually adjust colors.
|
||||||
raw_colors[7] = util.lighten_color(raw_colors[7], 0.25)
|
raw_colors[7] = util.blend_color(raw_colors[7], "#EEEEEE")
|
||||||
raw_colors[8] = util.darken_color(raw_colors[7], 0.30)
|
raw_colors[8] = util.darken_color(raw_colors[7], 0.30)
|
||||||
raw_colors[15] = util.lighten_color(raw_colors[15], 0.25)
|
raw_colors[15] = util.blend_color(raw_colors[15], "#EEEEEE")
|
||||||
|
|
||||||
colors = {"wallpaper": img, "special": {}, "colors": {}}
|
colors = {"wallpaper": img, "special": {}, "colors": {}}
|
||||||
colors["special"]["background"] = raw_colors[0]
|
colors["special"]["background"] = raw_colors[0]
|
||||||
|
@ -109,6 +109,18 @@ def lighten_color(color, amount):
|
|||||||
return rgb_to_hex(color)
|
return rgb_to_hex(color)
|
||||||
|
|
||||||
|
|
||||||
|
def blend_color(color, color2):
|
||||||
|
"""Blend two colors together."""
|
||||||
|
r1, g1, b1 = hex_to_rgb(color)
|
||||||
|
r2, g2, b2 = hex_to_rgb(color2)
|
||||||
|
|
||||||
|
r3 = int(0.5 * r1 + 0.5 * r2)
|
||||||
|
g3 = int(0.5 * g1 + 0.5 * g2)
|
||||||
|
b3 = int(0.5 * b1 + 0.5 * b2)
|
||||||
|
|
||||||
|
return rgb_to_hex((r3, g3, b3))
|
||||||
|
|
||||||
|
|
||||||
def disown(cmd):
|
def disown(cmd):
|
||||||
"""Call a system command in the background,
|
"""Call a system command in the background,
|
||||||
disown it and hide it's output."""
|
disown it and hide it's output."""
|
||||||
|
Loading…
Reference in New Issue
Block a user