sponsor Vim development Vim logo Vim Book Ad

color.vim : color parsing functions - lighten/darken color under cursor

 script karma  Rating 0/0, Downloaded by 942  Comments, bugs, improvements  Vim wiki

created by
Rom Grk
 
script type
utility
 
description
General RGB, HSL and #hex color transforming and basic parsing functions.

Are implemented two basic functions on top of that: (akin to less/sass functions with the same name)
• color#Lighten(color, [amount=5])  
• color#Darken(color, [amount=5])
(both default at 5%,
color can be string—'#599eff'— or number—0x599eff—,
amount can be float—eg 0.05— or number—eg 5 )

Example mappings: (alt-minus & alt-equal)

nnoremap <expr><M--> color#Test(expand('<cword>'))
            \? '"_ciw' . color#Darken(expand('<cword>')) . "\<Esc>"
            \: "\<Nop>"
nnoremap <expr><M-=> color#Test(expand('<cword>'))
            \? '"_ciw' . color#Lighten(expand('<cword>')) . "\<Esc>"
            \: "\<Nop>"
 
install details
Copy in autoload folder.

Available under the following repo: http://www.github.com/romgrk/lib.kom, with other various general scripting functions.
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
color.vim 1.0 2016-03-16 7.0 Rom Grk Initial upload
ip used for rating: 18.97.14.83

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github