/flycheck-css-colorguard

Extension for Flycheck that uses CSS Colorguard in order to warn you about using similar colors in your CSS file

Primary LanguageEmacs LispGNU General Public License v3.0GPL-3.0

flycheck-css-colorguard

License GPL 3 MELPA

This is extension for Flycheck. It uses CSS Colorguard and warns you when colors you've added are too similar to ones that already exist in your css file.

flycheck-irony screenshot

Installation

Melpa

Package in available on Melpa.

init.el

(eval-after-load 'flycheck
  '(add-hook 'flycheck-mode-hook #'flycheck-css-colorguard-setup))
(source gnu)
(source melpa)

(depends-on "flycheck-css-colorguard")

Manual install

Untill Melpa is sorted out place flycheck-css-colorguard.el somewhere on your system and load it. You'll need to have flycheck installed.

;; Replace ~/Projects/elisp/flycheck-css-colorguard/ with your location.
(add-to-list 'load-path "~/Projects/elisp/flycheck-css-colorguard/")
(load-library "flycheck-css-colorguard")
(eval-after-load 'flycheck
  '(add-hook 'flycheck-mode-hook #'flycheck-css-colorguard-setup))

Usage

Just open any css file. If flycheck is properly configured, flycheck-css-colorguard will start automatically.

CSS Colorguard installation

Make sure that you have CSS colorguard installed npm install -g colorguard.

Use CSS Colorguard version 1.0.0 or higher! If you for some reason need to support CSS Colorguard older then 1.0.0, take oldest revision of flycheck-css-colorguard.el and uncomment :error-parser and comment :error-patterns code.

If you can't install CSS Colorguard globally or can't put executable in $PATH:

(custom-set-variables
 '(flycheck-css-colorguard-executable "~/my_executables/colorguard"))')

CSS Colorguard options

CSS Colorguard supports only two options: --treshold <value from 0 to 100> and --options <your configuration in json file>. You can set those in your init.el:

(custom-set-variables
 '(flycheck-css-colorguard-threshold "5"))

If you set --options config file, CSS Colorguard will ignore --threshold, so there is no point for setting both of those.

(custom-set-variables
 '(flycheck-css-colorguard-config "config.json"))

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.