Skip to content

Instantly share code, notes, and snippets.

@gregnewman
Created October 13, 2009 10:11
Show Gist options
  • Select an option

  • Save gregnewman/209130 to your computer and use it in GitHub Desktop.

Select an option

Save gregnewman/209130 to your computer and use it in GitHub Desktop.
; Display CSS Hexadecimal color values
; as background to that value.
(defvar hexcolour-keywords
'(("#[abcdef[:digit:]]\\{6\\}"
(0 (put-text-property
(match-beginning 0)
(match-end 0)
'face (list :background
(match-string-no-properties 0)))))))
(defun hexcolour-add-to-font-lock ()
(font-lock-add-keywords nil hexcolour-keywords))
(add-hook 'css-mode-hook 'hexcolour-add-to-font-lock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment