Thank you @salutis for taking the time to report this!
The official code to colorize the mode line in God is as follows: [...]
The problem with that design is that the colour values are hard-coded: we cannot cleanly change them at the theme level. What we would need is for god-mode to define those as faces, using the defface syntax (evil-mode does this, for example). Then it would be easy to add support for them.
Do you know if god-mode is being actively maintained? Just asking because I notice it is in the emacsorhanage and I am not sure how that works, though there seem to be recent commits.
Thank you @protesilaos for taking time to reply and explain the problem. I am new to Emacs, and I did not know about the defface mechanism. Everything makes sense now. I am going to close this issue then, as it requires changes in the God mode before anything can be done in Modus.
Thank you so much for all your help. Honestly, I am blown away by how helpful and friendly the Emacs community is. I put the snippet into my .emacs file and everything works well. You rock!
You are welcome! Note that since this is a user-level customisation that you are doing, you are free to use any colour from the palette of the active Modus theme (e.g. you can use blue-active which is the keyword for a colour value defined in modus-themes-operandi-colors or modus-themes-vivendi-colors). This is also discussed at length in the manual (with practical examples). Also, note that the code above uses set-face-background, though you might prefer to change the foreground instead (set-face-foreground) or exert greater control with set-face-attribute.
Okay, just added the doc entry. It is fairly basic, though it links to other parts of the manual where "do-it-yourself" techniques are discussed in further detail.
I also included your name in the manual's "Acknowledgements" section for bringing this issue to my attention. Thanks!
I think we are all good now and am closing this. If you need any further help with this, such as to change colours, please let me know.
Note: I ended up with the snippet below. Phew! I hope my God-less mode-line and mode-line-inactive match Modus defaults. I wonder if there is a way to reference mode line colors semantically.
Note: I ended up with the snippet below. Phew! I hope my God-less mode-line and mode-line-inactive match Modus defaults.
Looks good! The only difference with the defaults, is that the :box uses a different colour: when it is :box t it means to use the same value as the :foreground whereas :box COLOR uses COLOR instead. Here are the defaults (though you are always free to change them):
(modus-themes-with-colors;; the rest of the code here(set-face-attribute'mode-linenil:foregroundfg-active:backgroundbg-active:boxfg-alt)(set-face-attribute'mode-line-inactivenil:foregroundfg-inactive:backgroundbg-inactive:boxbg-region))
I wonder if there is a way to reference mode line colors semantically.
You mean like active-mode-line-background, active-mode-line-border and so on? I had thought about that in the past but felt it was not flexible enough. Experience tells me that as we cover more faces and workflows we discover more edge cases where discretion is needed. The trickiest faces in that regard are for the mode line, diffs, and the various search and completion frameworks.
On another note, you do not need progn for this. Unlike the if statement where its "true" clause evaluates one form, cond always evaluates all forms that apply to a condition. So for if you need something like this:
(ifTRUE(prognonetwo)threefour)
Notice that the "else" part (three, four) does not need to be wrapped in progn.
Whereas you can try this in your scratch buffer to see how cond behaves with regard to inserting both numbers for each clause (place the point somewhere inside the code and do C-M-x for eval-defun):
(let((testt)); set this to nil as well(cond(test(insert"1")(insert"2"))(t(insert"3")(insert"4"))))
All right, here we go: correct default colors, no superfluous progn, and correctly spelled mode-line. You are a great teacher. Thank you so much for guiding me!