0

I know that we can customize org source block begin and end line colors using below config

(custom-set-faces!
  ;; Customize the header line of the source block
  '(org-block-begin-line :background "#1a1e26" :extend t)
  ;; Customize the footer line of the source block
  '(org-block-end-line :background "#1a1e26" :extend t)
)

But is it possible to have different color based on language or any other properties?

3
  • I may be wrong but I don't think there is any simple way: when you insert a block (no matter what the language is), it is inserted with the specified face and that face then is set to extend to the end of the line, so when you insert language, header arguments, etc., they get the same face. I don't see any way to make the face setting dynamic other than post-processing the block somehow. Commented Nov 8 at 15:49
  • ... or perhaps wrapping the insertion in your own function that takes the language as argument and then sets the faces based on that before inserting. That assumes that you will always use that function to insert source blocks. Commented Nov 8 at 15:52
  • On second thought, my last comment will probably run into trouble with font-lock. BTW, all of this is off the top of my head: I haven't tested anything. Commented Nov 10 at 14:51

1 Answer 1

0

AFAIK this may be related to your theme - the only one I know doing that is Protesilaos' Modus-theme, see this page. Maybe some other users knows another solutions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.