mirror of
https://github.com/dylanaraps/pywal.git
synced 2024-11-29 03:13:47 +01:00
colors: Add light theme support.
This commit is contained in:
parent
c4b5a667c9
commit
a3bedee34a
@ -1,5 +1,5 @@
|
|||||||
[BASIC]
|
[BASIC]
|
||||||
good-names=i,j,k,n,x,y,fg,bg,r,g,b,i3,r1,r2,r3,g1,g2,g3,b1,b2,b3
|
good-names=i,j,k,n,x,y,fg,bg,r,g,b,i3,r1,r2,r3,g1,g2,g3,b1,b2,b3,h,s,v
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
[MESSAGES CONTROL]
|
||||||
# inconsistent-return-statements:
|
# inconsistent-return-statements:
|
||||||
|
@ -64,7 +64,7 @@ def create_palette(img, colors, light):
|
|||||||
if light:
|
if light:
|
||||||
# Manually adjust colors.
|
# Manually adjust colors.
|
||||||
raw_colors[7] = raw_colors[0]
|
raw_colors[7] = raw_colors[0]
|
||||||
raw_colors[0] = util.lighten_color(raw_colors[15], 0.85)
|
raw_colors[0] = util.lighten_color(raw_colors[15], 0.90)
|
||||||
raw_colors[15] = raw_colors[7]
|
raw_colors[15] = raw_colors[7]
|
||||||
raw_colors[8] = util.lighten_color(raw_colors[7], 0.25)
|
raw_colors[8] = util.lighten_color(raw_colors[7], 0.25)
|
||||||
|
|
||||||
@ -75,7 +75,6 @@ def create_palette(img, colors, light):
|
|||||||
|
|
||||||
# Manually adjust colors.
|
# Manually adjust colors.
|
||||||
raw_colors[7] = util.blend_color(raw_colors[7], "#EEEEEE")
|
raw_colors[7] = util.blend_color(raw_colors[7], "#EEEEEE")
|
||||||
raw_colors[8] = util.darken_color(raw_colors[7], 0.30)
|
|
||||||
raw_colors[15] = util.blend_color(raw_colors[15], "#EEEEEE")
|
raw_colors[15] = util.blend_color(raw_colors[15], "#EEEEEE")
|
||||||
|
|
||||||
colors = {"wallpaper": img, "alpha": util.Color.alpha_num,
|
colors = {"wallpaper": img, "alpha": util.Color.alpha_num,
|
||||||
@ -86,10 +85,12 @@ def create_palette(img, colors, light):
|
|||||||
|
|
||||||
if light:
|
if light:
|
||||||
for i, color in enumerate(raw_colors):
|
for i, color in enumerate(raw_colors):
|
||||||
color = util.darken_color(color, 0.30)
|
colors["colors"]["color%s" % i] = util.saturate_color(color, 0.5)
|
||||||
colors["colors"]["color%s" % i] = util.saturate_color(color, 50)
|
|
||||||
|
|
||||||
colors["colors"]["color0"] = raw_colors[0]
|
colors["colors"]["color0"] = raw_colors[0]
|
||||||
|
colors["colors"]["color7"] = raw_colors[15]
|
||||||
|
colors["colors"]["color8"] = util.darken_color(raw_colors[0], 0.5)
|
||||||
|
colors["colors"]["color15"] = raw_colors[15]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for i, color in enumerate(raw_colors):
|
for i, color in enumerate(raw_colors):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
Misc helper functions.
|
Misc helper functions.
|
||||||
"""
|
"""
|
||||||
|
import colorsys
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
@ -124,12 +125,14 @@ def blend_color(color, color2):
|
|||||||
def saturate_color(color, amount):
|
def saturate_color(color, amount):
|
||||||
"""Saturate a hex color."""
|
"""Saturate a hex color."""
|
||||||
r, g, b = hex_to_rgb(color)
|
r, g, b = hex_to_rgb(color)
|
||||||
|
r, g, b = [x/255.0 for x in (r, g, b)]
|
||||||
|
h, s, v = colorsys.rgb_to_hsv(r, g, b)
|
||||||
|
s = amount
|
||||||
|
v = 0.2
|
||||||
|
r, g, b = colorsys.hls_to_rgb(h, s, v)
|
||||||
|
r, g, b = [x*255.0 for x in (r, g, b)]
|
||||||
|
|
||||||
r2 = r + amount
|
return rgb_to_hex((int(r), int(g), int(b)))
|
||||||
g2 = g + amount
|
|
||||||
b2 = b + amount
|
|
||||||
|
|
||||||
return rgb_to_hex((r2, g2, b2))
|
|
||||||
|
|
||||||
|
|
||||||
def disown(cmd):
|
def disown(cmd):
|
||||||
|
Loading…
Reference in New Issue
Block a user