diff options
| author | Simen Heggestøyl | 2018-01-28 13:03:05 +0100 |
|---|---|---|
| committer | Simen Heggestøyl | 2018-01-28 13:28:28 +0100 |
| commit | 97defdfc36d9a83a3081c5f76e249f908645f7ec (patch) | |
| tree | 8153be0281d8e52f9e3d32309347080242f65da4 /lisp | |
| parent | 9824885fabea53f8c4461d038f4c1edad1b8f591 (diff) | |
| download | emacs-97defdfc36d9a83a3081c5f76e249f908645f7ec.tar.gz emacs-97defdfc36d9a83a3081c5f76e249f908645f7ec.zip | |
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')
| -rw-r--r-- | lisp/textmodes/css-mode.el | 2 |
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." | |||
| 1458 | (if-let* ((alpha (css--hex-alpha hex)) | 1458 | (if-let* ((alpha (css--hex-alpha hex)) |
| 1459 | (a (css--format-rgba-alpha | 1459 | (a (css--format-rgba-alpha |
| 1460 | (/ (string-to-number alpha 16) | 1460 | (/ (string-to-number alpha 16) |
| 1461 | (float (expt 16 (length alpha))))))) | 1461 | (float (- (expt 16 (length alpha)) 1)))))) |
| 1462 | (format "rgba(%d, %d, %d, %s)" r g b a) | 1462 | (format "rgba(%d, %d, %d, %s)" r g b a) |
| 1463 | (format "rgb(%d, %d, %d)" r g b)) | 1463 | (format "rgb(%d, %d, %d)" r g b)) |
| 1464 | t)) | 1464 | t)) |