Skip to content

zakudriver/lacquer

Repository files navigation

Lacquer

https://melpa.org/packages/lacquer-badge.svg

Lacquer is a util that switches theme/font/font-size and to configure cache, and switch themes automatically. 😋

ps: using it with which-key is recommended.

Lacquer is more than a combination of circadian and cycle-themes. It has so many new features, such as, allows users to switch themes and fonts in a more convenient way, to customize each theme, also to define specifically when to switch themes automatically.

Features

  • Use both the selector and the shortcut key to switch themes/font.
  • Load previous theme/font/font-size after restarting the emacs.
  • Each theme can be configured individually.
  • Download unused themes automatically with package.el.
  • Generate interactive function automatically.
  • Automatically change themes depending on a time schedule created by users.
  • Distinguish light and dark, and switch themes based on system appearance.

Screencast

./imgs/theme-selector.png

./imgs/theme-keys.png

./imgs/font-selector.png

./imgs/font-keys.png

Installation

Lacquer is available thorough MELPA repository or download to your load-path.

Usage

;; which-key
(use-package which-key
  :hook
  (after-init . which-key-mode)
  :custom
  (which-key-popup-type 'minibuffer)
  (which-key-sort-order 'which-key-prefix-then-key-order))

;; lacquer
(use-package lacquer
    :hook
    (after-init . lacquer-auto-mode)
    :custom
    (lacquer-cache "~/.emacs.d/.lacquer.el")
    ;; (lacquer-auto-switch-time '("00:01" "00:02" "10:00" "14:00" "16:00" "18:00" "20:00" "22:00")) ;; Switch theme at these times.
    (lacquer-auto-switch-time (* 60 30)) ;; Switch theme every half hour.
    (lacquer-auto-switch-mode 'random)
    (lacquer-appearance-switch t)        ;; Switch theme once the system appearance is changed, and distinguish light and dark theme.
    (lacquer-theme-list '((monokai-theme monokai both)
                          (monokai-pro-theme monokai-pro dark)
                          (dracula-theme dracula dark)
                          (doom-themes doom-one-light)
                          (doom-themes doom-vibrant dark)
                          (doom-themes doom-nord dark)
                          (leuven-theme leuven light (setq leuven-scale-outline-headlines nil))
                          (leuven-theme leuven-dark (setq leuven-scale-outline-headlines nil))))
    (lacquer-font-list '(Menlo
                         Roboto\ Mono
                         Anonymous\ Pro
                         FantasqueSansMono
                         FiraMono
                         Fira\ Code
                         Operator\ Mono
                         Inconsolata
                         Iosevka))
    (lacquer-default-font-size 130))

How to distinguish light and dark theme

If lacquer-appearance-switch is enabled, switch theme once the system appearance is changed, and distinguish light and dark theme. It also works in lacquer-auto-switch-mode.

(defcustom lacquer-theme-list '((monokai-theme monokai))
  "Theme list.
E.g: \='((theme-package-name theme-name tag config)).
Required: theme-package-name theme-name.
Optional: tag(such as `light'/`dark'/`both'), config.

The config is any function about theme setting.
E.g: \='((leuven-theme leuven-dark
         (setq leuven-scale-outline-headlines nil)
         (message \"i may be a configuration.\"))).

===================== How to distinguish light and dark theme ↓↓↓ =====================

If `lacquer-appearance-switch' is enabled,
the `light'/`dark'/`both' tag is used to define the theme as light or
dark series, or the both series.
E.g: \='((leuven-theme leuven light
         (setq leuven-scale-outline-headlines nil)
         (message \"i may be a configuration.\"))).

When not set tag, how to distinguish light and dark:
It will depend on theme-name whether included \='light' or \='dark'.
If theme-name does not includes \='light' or \='dark', it will be \='both'.

I recommend labeling all themes of tags.
  
===================== How to distinguish light and dark theme ====================="
  :group 'lacquer
  :type '(alist :value-type (group symbol symbol symbol function)))

When emacs started in server mode: (Issues #4)

(after-init . (lambda () (if (daemonp) 
               (add-hook 'server-after-make-frame-hook #'lacquer-auto-mode)
             (lacquer-auto-mode))))

Customization

VariableDefaulttypeDescription
lacquer-theme-list’((monokai-theme monokai))listTheme list. E.g: ‘((theme-package-name theme-name tag config)).
lacquer-default-theme‘monokailistDefault theme.
lacquer-cache”~/.emacs.d/.lacquer”stringPath of lacquer cache.
lacquer-keys-map-index’(“1” “2” “3” … “a” “b” “c” … “z 1” “z 2”)listKeys map.
lacquer-font-list‘(Menlo Fira\ Code)listFont list. E.g: ‘(font-name).
lacquer-default-font‘MenlosymbolDefault font.
lacquer-default-font-size135integerDefault font size.
lacquer-theme-prefix-key“C-c T”stringTrigger theme of prefix key.
lacquer-font-prefix-key“C-c F”stringTrigger font of prefix key.
lacquer-mode-selector-key“C-c T M”stringMode selector bind key.
lacquer-font-size-step5integerChange font size of step.
lacquer-auto-switch-mode‘orderlysymbolMode of switch theme automatically. Currently supports ‘orderly and ‘random.
lacquer-auto-switch-time3600(seconds)integer/listWhen it’s list, switch themes at time of list item every day. And when it’s integer, switch themes for every THIS seconds.
lacquer-start-auto-switch-key“C-c T A”stringStart switch theme automatically bind key.
lacquer-stop-auto-switch-key“C-c T P”stringStop switch theme automatically bind key.
lacquer-appearance-switchnilbooleanIf it’s `no-nil’, switch theme by the system appearance is changed.

Command

CommandDescription
lacquer-current-themePrint current theme.
lacquer-current-fontPrint current font.
lacquer-theme-selectorOpen theme selector in the minibuffer.
lacquer-font-selectorOpen font selector in the minibuffer.
lacquer-font-size-increaseFont size increase.
lacquer-font-size-decreaseFont size decrease.
lacquer-start-auto-switchStart switch theme automatically.
lacquer-stop-auto-switchStop switch theme automatically.
lacquer-mode-selectorOpen mode selector in the minibuffer.
lacquer-start-appearance-switchStart appearance switch.
lacquer-stop-appearance-switchStop appearance switch.

About

a util that switches theme and to configure cache. 😋

Resources

License

Stars

Watchers

Forks

Packages

No packages published