Add command for cycling between CSS color formats
commitbd9e8b31a1a38a2ffa5c2ff5e805a42ffccc36ec
authorSimen Heggestøyl <simenheg@gmail.com>
Sat, 16 Dec 2017 08:49:54 +0000 (16 09:49 +0100)
committerSimen Heggestøyl <simenheg@gmail.com>
Sun, 17 Dec 2017 09:26:04 +0000 (17 10:26 +0100)
tree441203fb603da9188c2b96171abafbbffe0c8bac
parentac0d6c06b805b8f05a854a69639531bf737fea3f
Add command for cycling between CSS color formats

* lisp/textmodes/css-mode.el (css-mode-map): Add keybinding for
'css-cycle-color-format'.
(css--rgb-color): Add support for extracting alpha component.
(css--hex-alpha, css--color-to-4-dpc, css--named-color-to-hex)
(css--format-rgba-alpha, css--hex-to-rgb)
(css--rgb-to-named-color-or-hex): New functions.
(css-cycle-color-format): New command for cycling between color
formats.

* test/lisp/textmodes/css-mode-tests.el (css-test-color-to-4-dpc):
(css-test-named-color-to-hex, css-test-format-rgba-alpha)
(css-test-hex-to-rgb, css-test-rgb-to-named-color-or-hex)
(css-test-cycle-color-format, css-test-hex-alpha): New tests for the
changes mentioned above.

* etc/NEWS: Mention the new command.
etc/NEWS
lisp/textmodes/css-mode.el
test/lisp/textmodes/css-mode-tests.el