nano-theme icon indicating copy to clipboard operation
nano-theme copied to clipboard

Refactor theme to be used with `load-theme`.

Open canatella opened this issue 4 years ago • 8 comments

The main nano theme has been converted to a macro and the code moved to a new nano-theme-support.el file. That macro is now used to generate the light and dark theme. Those can be now loaded using M-x load-theme RET nano-light and M-x load-theme RET nano-dark.

A new nano-theme has been added that will automatically choose the light or dark style according to the frame background mode. It can be loaded using M-x load-theme RET nano.

This should fix PR #8.

canatella avatar Jan 14 '22 09:01 canatella

Thanks. Does that mean I still can have one frame using dark theme and another frame using light theme? Also, would that be possible to use 'git mv nano-theme.el nano-theme-support.el` such as to have a lighter PR? Last question, did you signed the Emacs copyright assignment (sorry for asking, but I don't know if there's a public registry).

rougier avatar Jan 17 '22 16:01 rougier

Does that mean I still can have one frame using dark theme and another frame using light theme? I just tried that and there are some issues with that, it would be nice if you could give it a shot, maybe you'll spot what's wrong in the theme faster then me. Also, would that be possible to use 'git mv nano-theme.el nano-theme-support.el` such as to have a lighter PR? Sure! Last question, did you signed the Emacs copyright assignment (sorry for asking, but I don't know if there's a public registry). Yup I did.

So wait a bit, I'll do more testing with different frames :)

canatella avatar Jan 17 '22 17:01 canatella

Hello,

I rebased this pull request and cleared up the frame vs global theme switching. There are now two types of functions:

  • nano-theme-frame-toggle, nano-frame-dark and nano-frame-light that switch theme only for the current frame
  • nano-theme-toggle, nano-dark and nano-light that changes the global theme and update all frames that have not switched using the previous frame function. So if you open 3 frame, and do nano-theme-toggle, the 3 frame switches. Then if you do nano-theme-frame-toggle in one of those, only that one will change. Then if you do nano-theme-toggle again, only the 2 frames that have not been manually switched will change.

The M-x load-theme commands now works as expected.

All theme have to be defined in files named <theme-name>-theme.el which explains why I had to create the new nano-theme-support file.

I have signed the Emacs copyright assignment.

canatella avatar Sep 13 '22 22:09 canatella

I understood what you meant by git mv :sweat_smile: Done!

canatella avatar Sep 14 '22 07:09 canatella

Wonderful, thanks! I'll test it locally before merging.

rougier avatar Sep 22 '22 07:09 rougier

Seems to work nicely. Only problem is initial loading of the theme that does not seem to enforce the font settings (I get 'bold for bold instead of 'medium). If I applied the theme or toggle it, then weight is correct.

rougier avatar Sep 22 '22 07:09 rougier

Ah I don't use the fonts so I did not notice. I'll have a look.

canatella avatar Sep 22 '22 10:09 canatella

It seems to be working here:

emacs --debug-init -q --eval '(add-to-list '"'"'load-path "~/.emacs.d/pkg/nano-theme/")' --eval '(setq custom-theme-load-path '"'"'("/home/dam/.emacs.d/pkg/nano-theme/"))' --eval '(setq nano-fonts-use t)' -l ~/.emacs.d/pkg/nano-theme/nano-theme-support.el  --eval '(load-theme '"'"'nano t)'

Then M-x describe-face bold: image

Then M-x describe-face nano-strong: image

canatella avatar Sep 24 '22 14:09 canatella

Ok, something must be wrong on my side.

rougier avatar Oct 10 '22 06:10 rougier