mirror of
https://github.com/dylanaraps/pywal.git
synced 2025-05-20 16:20:53 +02:00
use 16 color adjust in fast_colorthief
This commit is contained in:
parent
34e2dd28ab
commit
7aa7085d5f
@ -13,6 +13,7 @@ except ImportError:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
from .. import util
|
from .. import util
|
||||||
|
from .. import colors
|
||||||
|
|
||||||
|
|
||||||
def gen_colors(img):
|
def gen_colors(img):
|
||||||
@ -22,29 +23,15 @@ def gen_colors(img):
|
|||||||
return [util.rgb_to_hex(color) for color in raw_colors]
|
return [util.rgb_to_hex(color) for color in raw_colors]
|
||||||
|
|
||||||
|
|
||||||
def adjust(cols, light):
|
def adjust(cols, light, cols16):
|
||||||
"""Create palette."""
|
"""Create palette."""
|
||||||
cols.sort(key=util.rgb_to_yiq)
|
cols.sort(key=util.rgb_to_yiq)
|
||||||
raw_colors = [*cols, *cols]
|
raw_colors = [*cols, *cols]
|
||||||
|
|
||||||
if light:
|
return colors.generic_adjust(raw_colors, light, cols16)
|
||||||
raw_colors[0] = util.lighten_color(cols[0], 0.90)
|
|
||||||
raw_colors[7] = util.darken_color(cols[0], 0.75)
|
|
||||||
|
|
||||||
else:
|
|
||||||
for color in raw_colors:
|
|
||||||
color = util.lighten_color(color, 0.40)
|
|
||||||
|
|
||||||
raw_colors[0] = util.darken_color(cols[0], 0.80)
|
|
||||||
raw_colors[7] = util.lighten_color(cols[0], 0.60)
|
|
||||||
|
|
||||||
raw_colors[8] = util.lighten_color(cols[0], 0.20)
|
|
||||||
raw_colors[15] = raw_colors[7]
|
|
||||||
|
|
||||||
return raw_colors
|
|
||||||
|
|
||||||
|
|
||||||
def get(img, light=False):
|
def get(img, light=False, cols16=False):
|
||||||
"""Get colorscheme."""
|
"""Get colorscheme."""
|
||||||
cols = gen_colors(img)
|
cols = gen_colors(img)
|
||||||
return adjust(cols, light)
|
return adjust(cols, light, cols16)
|
||||||
|
Loading…
Reference in New Issue
Block a user