TheBB / spaceline

Powerline theme from Spacemacs
GNU General Public License v3.0
534 stars 60 forks source link

certain colors break the powerline separator on mac in emacs 27 #221

Open antifuchs opened 4 years ago

antifuchs commented 4 years ago

I'm trying to combine boon with spaceline (it has its own segment), and it uses the color "dark green" for some things. However, rendering the line on my mac in these circumstances breaks, and so I investigated.

The problems seems to be related to this function call, when powerline-image-apple-rgb is t (the default):

(let ((powerline-image-apple-rgb t)) (pl/hex-color "dark green"))

This causes an arithmetic overflow error with the following backtrace:

Debugger entered--Lisp error: (overflow-error)
  format("#%04x%04x%04x" 1.62999237993933 20864.91247534178 -0.0e+NaN)
  color-rgb-to-hex(2.487208941694255e-05 0.31837815633389455 -0.0e+NaN)
  apply(color-rgb-to-hex (2.487208941694255e-05 0.31837815633389455 -0.0e+NaN))
  pl/hex-color("dark green")
  (let ((powerline-image-apple-rgb t)) (pl/hex-color "dark green"))
  eval((let ((powerline-image-apple-rgb t)) (pl/hex-color "dark green")) t)
  eval-expression((let ((powerline-image-apple-rgb t)) (pl/hex-color "dark green")) nil nil 127)
  funcall-interactively(eval-expression (let ((powerline-image-apple-rgb t)) (pl/hex-color "dark green")) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

I'm not a color theorist so I have no idea if those conversions all make sense, but something weird seems to be going on in color.el, or powerline-separators.el (and this might be an emacs bug, so please feel free to redirect me!)

I'm using Emacs 27.0.90 on macOS 10.15.3.