summaryrefslogtreecommitdiff
path: root/lisp/textmodes/css-mode.el
diff options
context:
space:
mode:
authorSimen Heggestøyl <simenheg@gmail.com>2018-01-28 13:03:05 +0100
committerSimen Heggestøyl <simenheg@gmail.com>2018-01-28 13:28:28 +0100
commit97defdfc36d9a83a3081c5f76e249f908645f7ec (patch)
tree8153be0281d8e52f9e3d32309347080242f65da4 /lisp/textmodes/css-mode.el
parent9824885fabea53f8c4461d038f4c1edad1b8f591 (diff)
downloademacs-97defdfc36d9a83a3081c5f76e249f908645f7ec.tar.gz
Fix off-by-one error in 'css--hex-to-rgb'
* lisp/textmodes/css-mode.el (css--hex-to-rgb): Fix off-by-one error. * test/lisp/textmodes/css-mode-tests.el (css-test-hex-to-rgb): Add regression tests for the above fix.
Diffstat (limited to 'lisp/textmodes/css-mode.el')
-rw-r--r--lisp/textmodes/css-mode.el2
1 files changed, 1 insertions, 1 deletions
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 6bd08f59190..135c0d5f928 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1458,7 +1458,7 @@ should not be mixed with those in color.el."
(if-let* ((alpha (css--hex-alpha hex))
(a (css--format-rgba-alpha
(/ (string-to-number alpha 16)
- (float (expt 16 (length alpha)))))))
+ (float (- (expt 16 (length alpha)) 1))))))
(format "rgba(%d, %d, %d, %s)" r g b a)
(format "rgb(%d, %d, %d)" r g b))
t))