I've been having some fun with eshell prompts.
;; https://www.emacswiki.org/emacs/EshellPrompt#h5o-4
;; replaced reduce with cl-reduce
(defun shortened-path (path max-len)
"Return a modified version of `path', replacing some components
with single characters starting from the left to try and get
the path down to `max-len'"
(let* ((components (split-string (abbreviate-file-name path) "/"))
(len (+ (1- (length components))
(cl-reduce '+ components :key 'length)))
(str ""))
(while (and (> len max-len)
(cdr components))
(setq str (concat str (if (= 0 (length (car components)))
"/"
(string (elt (car components) 0) ?/)))
len (- len (1- (length (car components))))
components (cdr components)))
(concat str (cl-reduce (lambda (a b) (concat a "/" b)) components))))
(cl-defun my/eshell-prompt-fn (&key (highlight-color "#f06543") (path-color "#e1b07e") (error-color "#edb230"))
"Return a function that defines an eshell prompt."
(lambda nil
(concat
(propertize (format-time-string "[%T] ") 'face `(:foreground ,highlight-color))
(propertize (shortened-path (eshell/pwd) 40) 'face `(:foreground ,path-color))
(propertize (format " [%d]" eshell-last-command-status) 'face (if (= 0 eshell-last-command-status)
`(:foreground ,highlight-color)
`(:foreground ,error-color)))
(propertize " λ " 'face `(:foreground ,highlight-color)))))
To try it out:
;; save the original prompt in case you want to go back
(setq original-prompt-function eshell-prompt-function)
;; set new prompt
(setq eshell-prompt-function (my/eshell-prompt-fn :highlight-color "#7ebc89" :path-color "#607466" :error-color "#fe5d26"))
Play with the colors. https://coolors.co/