domtronn / spaceline-all-the-icons.el

A Spaceline Mode Line theme using All The Icons for Emacs
MIT License
235 stars 25 forks source link

HUD segment not showing in some configurations #29

Closed jwintz closed 7 years ago

jwintz commented 7 years ago

Fixed case when default foreground face color matches modeline background face color for HUD segment, which actually make it invisible.

domtronn commented 7 years ago

Thanks for the PR @jwintz - Sorry, I only just noticed this...

I've been thinking about this, and actually, the problem isn't that the colours are matching, but because the doom-one theme doesn't set the foreground of the mode-line face explicitly and instead inherits it, so when you call

(face-foreground 'mode-line)

It'll return nil despite things using that face having a foreground colour. This is actually an issue all over the place with the use of face-foreground & face-background. You'll probably see inMessages` that there is a bunch of

Invalid face attribute :background nil Invalid face attribute :foreground nil

Errors...

Probably the best solution is to add a wrapper around the face-foreground & face-background functions to fallback to using the default face if it can't get the colours for the given face, e.g.

(defun spaceline-all-the-icons--face-foreground (face)
  (or (face-foreground face)
      (face-foreground 'default))

I've tested this and it does make the errors go away which is good! So I'll probably add this in to the next minor version. I'll ping you when it's available and you can let me know what you think? 🙂

Again, thanks for drawing my attention to this problem!

domtronn commented 7 years ago

Believe this is fixed now :)