15

I am using a distraction-free mode that uses giant fringes to center the buffer called bzg-big-fringe-mode.

Problem is, these fringes often have a different color than the background which give an ugly visual effect (see the picture at the end).

I do not have a problem with fixing this manually, by setting the fringe color to the background color, like so:

(set-face-attribute 'fringe nil :background "#3F3F3F" :foreground "#3F3F3F")

Problem is, when changing themes the fringe colors remain gray, even though that does not make sense for the new theme.

Is there a way to programmatically set the fringe to the background color?

I guess I need two things:

  1. The ability to set the fringe background color to the default background color.
  2. A function that is hooked to changing themes and that does 1. above.

I think I should be able to do 2) even though I have no emacs skills, but how do I do 1)?

Or is this a bad idea for some reason? If so, what would a better approach look like?

enter image description here

The Unfun Cat
  • 2,393
  • 16
  • 32

3 Answers3

14

The official way would be customizing the theme in question to make the fringe face look the same as the background face. A face spec along the lines of (fringe :inherit default) should do the trick.

Alternatively, you can modify it on the fly using a code snippet:

(defun my-tone-down-fringes ()
  (set-face-attribute 'fringe nil
                      :foreground (face-foreground 'default)
                      :background (face-background 'default)))

The only problem left would be applying it on every theme change. I can't find any hook looking like it could do the job which is a bit sad, defadvice doesn't seem to work out properly either. At least not in Emacs 24.4

wasamasa
  • 21,803
  • 1
  • 65
  • 97
8

You can set the fringe color to nil, in which case you don't need to worry about any theme changes. I've got the following in my config:

(set-face-attribute 'fringe nil :background nil)

And the fringe just disappears.... :)

pandita
  • 235
  • 2
  • 7
0

Somehow 'fringe stopped working for me, and now this does:

(set-face-attribute 'linum nil :background "gray19")
yPhil
  • 963
  • 5
  • 22