NicolasPetton/zerodark-theme

Cursor color is black

Closed this issue · 14 comments

Hi, Nicolas, thank you for this nice theme.

I have an issue, my cursor color is black and there's no way to change it. Every time I start emacs, the cursor color is black over the default background, which makes it difficult to locate, sometimes.

I've reviewed carefully my code and deleted all custom color settings.

Is there a way to get the default foreground color, which is lighter, I presume?

Thanks,

Quim

Emacs version:
GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars) of 2015-10-01

Linux:
Linux 3.16.0-0.bpo.4-amd64 #1 SMP Debian 3.16.7-ckt4-3~bpo70+1 (2015-02-12) x86_64 GNU/Linux

vyp commented

Are you running emacs in the terminal, because I guess then it might be your terminal settings that are not allowing you to change the color? Because otherwise can't you just change the cursor face? I don't think it's a problem with the theme itself because it has this line:

`(cursor ((,class (:background ,default))))

I'm aware of this line, I even tried to change it and byte-compile the theme, without success.

Currently I start emacs server as a daemon in gui mode, plus emacsclient, executing a script from the terminal:

emacs --daemon=DEV >/dev/null 2>&1 &
emacsclient -c -s DEV -f emacsdev -q &

I call (load-theme 'zerodark t) at the end of my .emacs file, immediately before (provide 'emacs), trying to override any previous settings, without success.

As a workaround the cursor color looks fine when loading the theme manually once emacsclient has started.

vyp commented

Just a stab in the dark, I remember something about having problems with themes when starting as a daemon due to something about no frame being made... can you try the following (at the end of your .emacs):

(if (daemonp)
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (with-selected-frame frame
                  (load-theme 'zerodark t))))
  (load-theme 'zerodark t))

As a workaround the cursor color looks fine when loading the theme manually once emacsclient has started.

This is why I'm guessing the above...

Your guess is right! That do the trick.

Thank you very much.

vyp commented

Awesome! ✨

It may be useful if you put this code in the README as an advice...

vyp commented

I don't use melpa, I wonder if the problem still happens when doing:

M-x package-install RET zerodark-theme

instead?

Anyway, I'm not the author here, so I'll let @NicolasPetton decide if he wants to add that to the README. I agree though, it's probably useful to put there.

vyp commented

Ah thanks for trying that out, I wonder if it could solved directly in zerodark-theme.el somehow? Otherwise yes, I guess it should be put in the README then.

vyp commented

That's okay, Nicolas will probably know the answer.

I am glad you're issue is solved. I don't know if there is a way to fix the problem in the theme itself though.

Did not know about that hook! I was getting a black cursor on new frames in tsdh-dark and other dark themes. Fixed it with:
(add-hook 'after-make-frame-functions
(lambda (frame)
(with-selected-frame frame
(set-cursor-color "cyan"))))