Refactored the darken formula in the color helper
This commit is contained in:
parent
f0097b53f5
commit
cc79a2eca9
@ -75,8 +75,8 @@ function! color_helper#hex_color_lighten(color, percent)
|
|||||||
let l:rgb = color_helper#hex_color_to_rgb(a:color)
|
let l:rgb = color_helper#hex_color_to_rgb(a:color)
|
||||||
let l:rgb_lightened = []
|
let l:rgb_lightened = []
|
||||||
|
|
||||||
for decimal in l:rgb
|
for i in l:rgb
|
||||||
call add(l:rgb_lightened, float2nr(decimal * (a:percent + 1)))
|
call add(l:rgb_lightened, float2nr(i + ((255 - i) * a:percent)))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return color_helper#rgb_color_to_hex(l:rgb_lightened)
|
return color_helper#rgb_color_to_hex(l:rgb_lightened)
|
||||||
@ -93,8 +93,8 @@ function! color_helper#hex_color_darken(color, percent)
|
|||||||
let l:rgb = color_helper#hex_color_to_rgb(a:color)
|
let l:rgb = color_helper#hex_color_to_rgb(a:color)
|
||||||
let l:rgb_darkened = []
|
let l:rgb_darkened = []
|
||||||
|
|
||||||
for decimal in l:rgb
|
for i in l:rgb
|
||||||
call add(l:rgb_darkened, float2nr(decimal * (1 - a:percent)))
|
call add(l:rgb_darkened, float2nr(i * (1 - a:percent)))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return color_helper#rgb_color_to_hex(l:rgb_darkened)
|
return color_helper#rgb_color_to_hex(l:rgb_darkened)
|
||||||
|
Loading…
Reference in New Issue
Block a user