From cc79a2eca962bcdc74b444a0574a8db2e29459a1 Mon Sep 17 00:00:00 2001 From: Nate Kane Date: Fri, 10 Dec 2010 23:17:28 +1000 Subject: [PATCH] Refactored the darken formula in the color helper --- autoload/color_helper.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/autoload/color_helper.vim b/autoload/color_helper.vim index 7537253..d8c6241 100644 --- a/autoload/color_helper.vim +++ b/autoload/color_helper.vim @@ -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_lightened = [] - for decimal in l:rgb - call add(l:rgb_lightened, float2nr(decimal * (a:percent + 1))) + for i in l:rgb + call add(l:rgb_lightened, float2nr(i + ((255 - i) * a:percent))) endfor 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_darkened = [] - for decimal in l:rgb - call add(l:rgb_darkened, float2nr(decimal * (1 - a:percent))) + for i in l:rgb + call add(l:rgb_darkened, float2nr(i * (1 - a:percent))) endfor return color_helper#rgb_color_to_hex(l:rgb_darkened)