doomemacs / doomemacs

An Emacs framework for the stubborn martian hacker
MIT License
19.35k stars 3.05k forks source link

How to create a customized doom-theme? #2732

Closed romanakmath closed 4 years ago

romanakmath commented 4 years ago

What are you trying to achieve? Good day, I come from spacemacs and would like to create a custom theme based on some doom-theme. Let's say I want to take doom-acario-light theme as a base and change the background under the cursor either by having an extra theme selectable doom-mycustomtheme or by (less preferable) changing doom-acario-light theme. Or, to be more specific, the background in the ivy buffer has almost the same color as the highlighting, I would really like to change it.

What have you tried? I looked at the destination of doom-themes. For me they are located in ~/.emacs.d/.local/straight/repos/emacs-doom-themes/themes. My guess is that I could copy an doom-acario-light-theme.el file. I am not sure however, if this is how it is intended to be done and if it will be automatically recognized. Placing some themes in my ~/.doom.d/themes and invoking them by (add-to-list 'custom-theme-load-path "~/.doom.d/themes") in my config file resulted in having wrong background and other artifacts when using this theme, which is why I would like to do it the "proprietary" doom way.

In brief: I want to have a custom theme based on a doom themes, which keeps its nice properties like solaire mode and has some different color choises and I am not sure how to achieve this.

Additional information Examplery themes file Example display

System information

emacs   version    26.3
        features   XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB NOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS XWIDGETS LIBSYSTEMD LCMS2
        build      Sep 16, 2019
        buildopts  (--build=x86_64-linux-gnu --prefix=/usr '--includedir=${prefix}/include' '--mandir=${prefix}/share/man' '--infodir=${prefix}/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules '--libdir=${prefix}/lib/x86_64-linux-gnu' '--libexecdir=${prefix}/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --sharedstatedir=/var/lib --program-suffix=26 --with-modules --with-file-notification=inotify --with-mailutils --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets --with-lcms2 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs26-TP6iDo/emacs26-26.3~1.git96dd019=. -fstack-protector-strong -Wformat -Werror=format-security -no-pie' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro -no-pie')
        windowsys  x
        daemonp    server-running
doom    version    2.0.9
        build      HEAD -> develop 4b20c7206 2020-03-13 17:34:44 -0400
        dir        ~/.doom.d/
system  type       gnu/linux
        config     x86_64-pc-linux-gnu
        shell      /bin/bash
        uname      Linux 4.4.0-18362-Microsoft #1-Microsoft Mon Mar 18 12:02:00 PST 2019 x86_64
        path       (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/local/games /mnt/c/ProgramData/Oracle/Java/javapath /mnt/c/Program Files (x86)/Intel/iCLS Client/ /mnt/c/Program Files/Intel/iCLS Client/ /mnt/c/Windows/system32 /mnt/c/Windows /mnt/c/Windows/System32/Wbem /mnt/c/Windows/System32/WindowsPowerShell/v1.0/ /mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL /mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL /mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/IPT /mnt/c/Program Files/Intel/Intel(R) Management Engine Components/IPT /mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common /mnt/c/Program Files/Git/cmd /mnt/d/Dropbox/programmes/emax26.2/bin /mnt/c/WINDOWS/system32 /mnt/c/WINDOWS /mnt/c/WINDOWS/System32/Wbem /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/ /mnt/c/WINDOWS/System32/OpenSSH/ /mnt/c/Program Files/texlive/2018/bin/win32 /mnt/c/ProgramData/chocolatey/bin /mnt/c/ProgramData/Anaconda3/Scripts/ /mnt/c/Program Files/Intel/WiFi/bin/ /mnt/c/Program Files/Common Files/Intel/WirelessCommon/ /mnt/c/Users/CLEVO/emax64ver26.3.7/bin /%CYGWIN% /mnt/c/cygwin64 /mnt/c/cygwin64/bin /mnt/c/Program Files/Git/usr/bin /mnt/c/Program Files (x86)/QuickTime/QTSystem/ /mnt/c/Program Files/LLVM/bin /mnt/d/Dropbox/programmes/emax191229/bin /mnt/c/ProgramData/Anaconda3 /mnt/c/Users/CLEVO/AppData/Local/Microsoft/WindowsApps /snap/bin /usr/lib/x86_64-linux-gnu/emacs/26.3/x86_64-linux-gnu/)
config  envfile    envvar-file
        elc-files  0
        modules    (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo hydra indent-guides modeline nav-flash ophints (popup +defaults) tabs treemacs vc-gutter vi-tilde-fringe window-select workspaces zen :editor (evil +everywhere) file-templates fold multiple-cursors rotate-text snippets :emacs dired electric ibuffer vc :term shell :checkers syntax spell :tools (eval +overlay) lookup magit pdf :lang data emacs-lisp latex markdown (org +dragndrop +present) python sh :config (default +bindings +smartparens))
        packages   (n/a)
        unpin      (n/a)
        elpa       (n/a)
hlissner commented 4 years ago

A simple way to add your own doom theme is to:

  1. Copy doom-acario-light-theme.el to ~/.doom.d/themes/my-acario-light-theme.el.
  2. Change the name of the theme in my-acario-light-theme.el; this way there are no conflicts:
-(def-doom-theme doom-acario-light-theme
+(def-doom-theme my-acario-light-theme
  1. Then add (setq doom-theme 'my-acario-light) to ~/.doom.d/config.el.

You don't need to mess with custom-theme-load-path. custom-theme-directory is already set to ~/.doom.d/themes and is already in custom-theme-load-path.

romanakmath commented 4 years ago

Thank you a lot for the hint. One interesting thing happens when I use my theme against the original one, the background changes, even though I haven't edited the theme: acario-light original: vcxsrv_ZSptoqP0S1 acario-light custom: vcxsrv_8EGWH4GGf3 What is the reason for this? I use a symbolic link for .doom.d directory, but I don't think it matters.

hlissner commented 4 years ago

This is perhaps because load-theme doesn't disable previously enabled themes. As of 0e2c9e8cb this should be fixed. Let me know if that is the case.

romanakmath commented 4 years ago

This problem occurs only if I switch to another theme and then back to the my-acario-light theme. If I start with my theme everything is normal. Since I am not changing themes during emacs sessions I will close the issue.