org-mode

orgmode - change code block background color


Below code will change html export background color to #eff0fe:

#+ATTR_HTML: :style background-color:#eff0fe;
#+BEGIN_EXAMPLE
hello world!
#+END_EXAMPLE

like below: enter image description here

How can we change the background color when edit in emacs?

I saw Pretty fontification of source code blocks document but sounds like it doesn't work for me!


Solution

  • Sounds like some face name changed, below config works:

    (custom-set-faces
     '(org-block-begin-line
       ((t (:underline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF" :extend t))))
     '(org-block
       ((t (:background "#EFF0F1" :extend t))))
     '(org-block-end-line
       ((t (:overline "#A7A6AA" :foreground "#008ED1" :background "#EAEAFF" :extend t))))
     )
    

    Output: enter image description here