Last Updated: February 25, 2016
·
1.918K
· algorgeous

Convert Hex color values to uppercase/lowercase with Vim

Here's a useful tip I use to keep my CSS files up to Drupal coding standards.

The following will convert all hex code color values (either #FFF or #FFFFFF) to lowercase.

:%s/#[0-9a-f]{3,6}/\L&/gi

If you want to convert to all uppercase, try this.

:%s/#[0-9a-f]{3,6}/\U&/gi