dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
550 stars 51 forks source link

Weird color behaviour #54

Closed mathsaey closed 6 years ago

mathsaey commented 6 years ago

Telephone-line seems to be rendering my separator colors incorrectly.

Here's all of my config that's related to telephone-line:

(use-package telephone-line
  :ensure t
  :config
    (setq
      telephone-line-height 24
      telephone-line-primary-left-separator 'telephone-line-cubed-left
      telephone-line-primary-right-separator 'telephone-line-cubed-right
      telephone-line-secondary-left-separator 'telephone-line-cubed-hollow-left
      telephone-line-secondary-right-separator'telephone-line-cubed-hollow-right)

    (require 'telephone-line-config)
    (telephone-line-evil-config))

And here's a screenshot of the result:

screen shot 2017-11-11 at 01 57 21

This seems to occur regardless of the theme I use. I'm pretty new to emacs though, so there is a pretty high chance that I made a mistake somewhere.

dbordak commented 6 years ago

That is odd, but sounds familiar... Are you on OSX? I seem to recall something about Emacs on OSX having screwed up colors in images (the color discrepancy in your image is between stuff that is rendered as text and stuff that is rendered as images)

EDIT: Err.. OSX, MacOS, whatever they call it these days :/

mathsaey commented 6 years ago

That seems to be the problem I'm dealing with. Adding (setq ns-use-srgb-colorspace nil) to my config seems to fix the issue. Unfortunately, that just disables srgb colors everywhere, which makes everything look rather ugly.

Thanks for the pointer! I'll see if I can find a better workaround and post it here if I find something.

dbordak commented 6 years ago

I looked into it a bit, there's a patched version of emacs over here: https://github.com/railwaycat/homebrew-emacsmacport

I can also patch it within telephone-line, but considering how there's something like this unpatched in upstream, shouldn't there be other things fixed in that? I don't know if it's right to fix one bug to help people use the more buggy version, if you know what I mean.

mathsaey commented 6 years ago

I can also patch it within telephone-line, but considering how there's something like this unpatched in upstream, shouldn't there be other things fixed in that? I don't know if it's right to fix one bug to help people use the more buggy version, if you know what I mean.

Powerline (and some other plugins) seem to have built-in workarounds, but I agree with your approach.

Thanks for looking into this!

mathsaey commented 6 years ago

I closed this since this seems to be an upstream problem. If I do find some workaround (which does not rely on the mac port), I'll post it here.

seagle0128 commented 5 years ago

(setq ns-use-srgb-colorspace nil) works for me as a workaround.

In powerline, colors are converted from sRGB color space to Apple RGB on macOS.

(defun pl/color-srgb-to-apple-rgb (red green blue)
  "Convert RED GREEN BLUE colors from sRGB color space to Apple RGB.
RED, GREEN and BLUE should be between 0.0 and 1.0, inclusive."
  (apply 'pl/color-xyz-to-apple-rgb (color-srgb-to-xyz red green blue)))

(defun pl/hex-color (color)
  "Get the hexadecimal value of COLOR."
  (when color
    (let ((srgb-color (color-name-to-rgb color)))
      (if powerline-image-apple-rgb
          (apply 'color-rgb-to-hex (apply 'pl/color-srgb-to-apple-rgb srgb-color))
        (apply 'color-rgb-to-hex srgb-color)))))