minibuffer-setup-hook is used only when the minibuffer is set up, i.e., activated, not when it is deactivated.
minibuffer-exit-hook takes effect when the minibuffer is exited. There is also
But although those do initiate the color change (as shown by adding
(debug) at the beginning of the hook function, and then stepping through the debugger with
d), it seems that
kill-local-variables removes the added color at some point. I don't have time now to check further, but perhaps you can, or perhaps someone else has a quick solution. Sorry for providing only incomplete info.
Gotta go now - but quickly, I'm guessing that maybe you don't need to fiddle with hooks at all, and you can just do the face remapping for all buffers with names matching
FWIW, I use a separate minibuffer frame, and I put this on
minibuffer-exit-hook to color the frame background:
(defun 1on1-color-minibuffer-frame-on-exit ()
"Change background of minibuffer frame to reflect the minibuffer depth.
Use this when reducing the minibuffer recursion depth."
(cond ((= (minibuffer-depth) 2)
((< (minibuffer-depth) 2)
(set-background-color (hexrgb-increment-hue ; Change bg hue slightly.
(frame-parameter nil 'background-color)