branch: master commit 5fcac7c578b64112c9194deb5e8a73d3658b4262 Author: Julien Danjou <jul...@danjou.info> Commit: Julien Danjou <jul...@danjou.info>
Fix a off-by-one error and some wording in rainbow-mode * packages/rainbow-mode/rainbow-mode.el (rainbow-color-luminance): Fix a off-by-one error and wording. (rainbow-x-color-luminance): Fix wording. Thanks Peder Stray. --- packages/rainbow-mode/rainbow-mode.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rainbow-mode/rainbow-mode.el b/packages/rainbow-mode/rainbow-mode.el index 275ca86..084fcd4 100644 --- a/packages/rainbow-mode/rainbow-mode.el +++ b/packages/rainbow-mode/rainbow-mode.el @@ -1116,12 +1116,12 @@ If the percentage value is above 100, it's converted to 100." (rainbow-colorize-match color)))) (defun rainbow-color-luminance (red green blue) - "Calculate the luminance of color composed of RED, GREEN and BLUE. + "Calculate the relative luminance of color composed of RED, GREEN and BLUE. Return a value between 0 and 1." - (/ (+ (* .2126 red) (* .7152 green) (* .0722 blue)) 256)) + (/ (+ (* .2126 red) (* .7152 green) (* .0722 blue)) 255)) (defun rainbow-x-color-luminance (color) - "Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\"). + "Calculate the relative luminance of a color string (e.g. \"#ffaa00\", \"blue\"). Return a value between 0 and 1." (let* ((values (x-color-values color)) (r (/ (car values) 256.0))