Skip to content

Instantly share code, notes, and snippets.

@lgmoneda
Last active May 2, 2020 14:40
Show Gist options
  • Save lgmoneda/201a181f0b9ea57216457a7b63e364ae to your computer and use it in GitHub Desktop.
Save lgmoneda/201a181f0b9ea57216457a7b63e364ae to your computer and use it in GitHub Desktop.
Adding Processing colors to rainbow-mode

Adding Processing "color"

Add the rainbow-mode package to your init.el and the proper config to add it to the processing mode and recognize the color:

(use-package rainbow-mode
  :ensure t
  :config
  (add-to-list 'rainbow-html-colors-major-mode-list 'processing-mode)
  (add-to-list 'rainbow-html-rgb-colors-font-lock-keywords
			   '("color(\s*\\([0-9]\\{1,3\\}\\(?:\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*)"
				 (0 (rainbow-colorize-rgb))))
  )

And it's done!

Here's the result:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment