nasyxx / emacs-site-lisp

Nasy's Emacs 之寚

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nasy Emacs 之寚

;;; python-isort.el --- Utility to sort Python imports -*- lexical-binding: t; -*-

(require 'reformatter)

(defcustom python-isort-command "isort"
  "Name of the `isort` executable."
  :group 'nasy
  :type 'string)

(defvar python-isort--base-args '("--quiet" "--atomic")
  "Base arguments to pass to isort.")

(defcustom python-isort-extra-args nil
  "Extra arguments to pass to isort."
  :group 'nasy
  :type '(repeat string))

;;;###autoload (autoload 'python-isort-buffer "python-isort" nil t)
;;;###autoload (autoload 'python-isort-region "python-isort" nil t)
;;;###autoload (autoload 'python-isort-on-save-mode "python-isort" nil t)
(reformatter-define python-isort
  :program python-isort-command
  :args (python-isort--make-args beg end)
  :lighter " isort"
  :group 'python-isort)

(defun python-isort--make-args (beg end)
  "Helper to build the argument list for isort for span BEG to END."
  (append python-isort--base-args
          python-isort-extra-args
          '("-")))

(provide 'python-isort)
;;; python-isort.el ends here

2 外皃 Theme

外皃

Nasy’s Emacs Theme

2.1 Colors

;;; 彩.el --- Nasy's Emacs theme colors.  -*- lexical-binding: t; -*-

;;; Commentary:

;;; Code:

;;; 正色
(defconst n-青       "#00ffff")
(defconst n-赤       "#c3272b")
(defconst n-白       "#ffffff")  ;; 精白
(defconst n-黑       "#000000")
(defconst n-黄       "#fff143")  ;; 不知其法而用鵝黃


;;; 間色
(defconst n-紺青     "#3f4470")
(defconst n-鴉青     "#424c50")
(defconst n-靛藍     "#065279")
(defconst n-羣青     "#2e59a7")
(defconst n-深竹月   "#2e62cd")
(defconst n-寶藍     "#4b5cc4")
(defconst n-青冥     "#3271ae")
(defconst n-靛青     "#177CB0")
(defconst n-湖藍     "#30DFF3")
(defconst n--青      "#00ffff")

(defconst n-松绿     "#057748")
(defconst n-官緑     "#2a6e3f")
(defconst n-青青     "#4f6f46")
(defconst n-蒼翠     "#519a73")
(defconst n-菉竹     "#698e6a")
(defconst n-竹靑     "#789262")
(defconst n-春辰     "#a9be7b")
(defconst n-松花     "#bce672")
(defconst n-歐碧     "#c0d695")
(defconst n-龍泉靑瓷 "#c8e6c6")
(defconst n-水緑     "#d4f2e7")
(defconst n-水黄     "#ddeec4")
(defconst n-春緑     "#e3efd1")
(defconst n-蔥青     "#edfebb")

(defconst n-絳       "#510312")
(defconst n-胭脂     "#960018")
(defconst n-綪       "#b13546")
(defconst n-品红     "#F00056")
(defconst n-朱       "#ff0000")
(defconst n-火红     "#FF2D51")
(defconst n-丹       "#ff4c00")
(defconst n-妃       "#ed5736")
(defconst n-海棠     "#DB5A6B")
(defconst n-桃红     "#f47983")
(defconst n-鳳仙粉   "#FF9393")
(defconst n-粉红     "#ffb3a7")
(defconst n-露玫瑰   "#ffe4e1")


(defconst n-墨       "#50616D")
(defconst n-蒼青     "#7397ab")
(defconst n-墨灰     "#758A99")

(defconst n-养生主   "#b49b7f")

(defconst n-茶       "#B35C44")
(defconst n-鱼肚     "#FCEFE8")
(defconst n-珈琲椶   "#705438")
(defconst n-紙棕     "#D2B38C")
(defconst n-向日黃   "#FFC34D")
(defconst n-缟       "#F2ECDE")
(defconst n-牙       "#EEDEB0")
(defconst n-米灰     "#D3CBAF")
(defconst n-芽灰     "#E3DBBF")
(defconst n-胡粉     "#FFFAE8")
(defconst n-蠟白     "#FEF8DE")
(defconst n-富春紡   "#FEF4B4")
(defconst n-鹅黄     "#FFF143")
(defconst n-嬭油     "#fffdd0")
(defconst n-鸭黄     "#FAFF72")
(defconst n-蛤粉     "#fdfff4")
(defconst n-荼       "#F3F9F1")
(defconst n-素       "#E0F0E9")
(defconst n-霜       "#E9F1F6")
(defconst n-漆       "#161823")
(defconst n-黛       "#4A4266")
(defconst n-丁香     "#CCA4E3")
(defconst n-青莲     "#801DAE")
(defconst n-淡紫丁香 "#e6cfe6")
(defconst n-水紅     "#f3d3e7")
(defconst n-長萅蕐   "#FF47D1")
(defconst n-紫扇貝   "#923A60")

(provide '彩)
;;; 彩.el ends here

2.2 Definition

(defgroup nasy-theme nil
  "Options of Nasy's theme."
  :group 'faces)

(defcustom nasy-theme-light/dark 'light
  "Nasy theme uses light theme or dark theme?"
  :group 'nasy-theme
  :type 'symbol)

(defcustom nasy-theme-org-scale t
  "Nasy theme uses scale up in `org-mode' or not."
  :group 'nasy-theme
  :type 'boolean)

(defcustom nasy-theme-underlines-list '(comment constant dash-string keyword hl-line)
  "Nasy theme uses underline on list.

 Should be one or more in `comment', `hl-line', `constant', `dash-string', `keyword'."
  :group 'nasy-theme
  :type '(list symbol))

(defcustom nasy-theme-fixed-pitch-font "Recursive Mono Casual Static"
  "Nasy theme fixed pitch font."
  :group 'nasy-theme
  :type 'string)

(defcustom nasy-theme-variable-pitch-font "Cardo"
  "Nasy theme variable pitch font."
  :group 'nasy-theme
  :type 'string)

(defcustom nasy-theme-variable-pitch-font-weight 'regular
  "Nasy theme variable pitch font weight."
  :group 'nasy-theme
  :type 'symbol)

(defcustom nasy-theme-fixed-pitch-font-scale 1.0
  "Nasy theme fixed pitch font scale."
  :group 'nasy-theme
  :type 'float)

(defcustom nasy-theme-variable-pitch-font-scale 1.3
  "Nasy theme variable pitch font scale."
  :group 'nasy-theme
  :type 'float)

(defcustom nasy-theme-rescale-f/v-pitch-font t
  "Nasy theme rescale f/v-pitch-font or not."
  :group 'nasy-theme
  :type 'boolean)

(defun nasy-theme--light?dark (light dark)
  "Determine using the LIGHT or the DARK color of nasy-theme."
  (if (eq nasy-theme-light/dark 'light)
      light
    dark))
(defalias '--l?d #'nasy-theme--light?dark)

(defun nasy-theme--scale? (scale)
  "Determine using `org-mode' SCALE or not."
  (if nasy-theme-org-scale
      scale
    1))
(defalias '--s? #'nasy-theme--scale?)

(defun nasy-theme--check-underline-list (sym)
  "Check if SYM in `nasy-theme-underlines-list' or not."
  (when (memq sym nasy-theme-underlines-list)
    t))
(defalias '--u? #'nasy-theme--check-underline-list)

(defun nasy-theme--rescale-font ()
  "Nasy theme rescale font."
  (when nasy-theme-rescale-f/v-pitch-font
    (setf (alist-get
           nasy-theme-fixed-pitch-font
           face-font-rescale-alist
           nasy-theme-fixed-pitch-font-scale nil 'string=)
          nasy-theme-fixed-pitch-font-scale)
    (setf (alist-get
           nasy-theme-variable-pitch-font
           face-font-rescale-alist
           nasy-theme-variable-pitch-font-scale nil 'string=)
          nasy-theme-variable-pitch-font-scale)))

(nasy-theme--rescale-font)

2.3 Theme

(deftheme nasy)

(let* ((class  '((class color) (min-colors 88) (background light)))
       (classd '((class color) (min-colors 88) (background dark)))
       (n/淺背景    "#f4daefb6e3b6")  ;; (color-lighten-name n-缟 1.45)
       (n/深背景    "#f109ea21da05")  ;; (color-darken-name n-缟 1.45)
       (n/深深背景  "#ef20e757d52d")  ;; (color-darken-name n-缟 2.9)
       (nd/淺背景   "#1667187123a5")  ;; (color-lighten-name n-漆 1.45)
       (nd/淺淺背景 "#16b918ca2427")  ;; (color-lighten-name n-漆 2.9)
       (n/丁香青莲  (--l?d n-青莲 n-青莲))
       (n/墨墨灰    (--l?d n-墨 n-墨灰))
       (n/墨灰墨    (--l?d n-墨灰 n-墨))
       (n/墨灰素    (--l?d n-墨灰 n-素))
       (n/墨缟      (--l?d n-墨 n-缟))
       (n/湖藍靛青  (--l?d n-湖藍 n-靛青))
       (n/漆缟      (--l?d n-漆 n-缟))
       (n/牙墨      (--l?d n-牙 n-墨))
       (n/牙黛      (--l?d n-牙 n-黛))
       (n/素墨      (--l?d n-素 n-墨))
       (n/素墨灰    (--l?d n-素 n-墨灰))
       (n/缟墨      (--l?d n-缟 n-墨))
       (n/缟漆      (--l?d n-缟 n-漆))
       (n/缟黛      (--l?d n-缟 n-黛))
       (n/霜黛      (--l?d n-霜 n-黛))
       (n/青莲丁香  (--l?d n-青莲 n-丁香))
       (n/青莲牙    (--l?d n-青莲 n-牙))
       (n/靛青湖藍  (--l?d n-靛青 n-湖藍))
       (n/黛缟      (--l?d n-黛 n-缟))
       (n/黛霜      (--l?d n-黛 n-霜)))
  (custom-theme-set-faces
   'nasy
   ;;; essential styles
   `(default ((,class (:foreground ,n/墨缟 :background ,n/缟漆))))

   ;;; Basic
   `(bold ((,class (:weight bold))))
   `(button          ((,class (:box (:line-width 1) :underline t :weight bold))))
   `(cursor          ((,class (:background ,n/黛霜 :foreground ,n/霜黛))))
   `(error           ((,class (:background ,n-鳳仙粉 :foreground ,n-紫扇貝 :weight bold))))
   `(escape-glyph    ((,class (:foreground ,n-茶))))
   `(fixed-pitch
     ((,class (:family ,nasy-theme-fixed-pitch-font))))
   `(fixed-pitch-serif ((t (:inherit fixed-pitch))))
   `(fringe          ((,class (:background ,n/缟漆 :foreground ,n/墨缟))))
   `(header-line     ((,class (:background ,n-:box (:line-width 2 :style released-button)
                                           :extend t
                                           :foreground ,n/靛青湖藍))))
   `(highlight    ((,class (:background ,n-米灰
                                        :distant-foreground ,n/霜黛))))
   `(internal-border ((,class (:background ,n/缟漆))))
   `(link         ((,class (:foreground ,n-靛青 :underline t))))
   `(link-visited ((,class (:foreground ,n-青莲 :underline t))))
   `(region       ((,class (:background ,n-蠟白 :distant-foreground ,n/墨缟 :extend t))))
   `(secondary-selection ((,class (:background ,n-芽灰))))
   `(success      ((,class (:background ,n-鱼肚 :foreground ,n-靛青 :weight bold))))
   `(variable-pitch
     ((,class (:family ,nasy-theme-variable-pitch-font
                       :weight ,nasy-theme-variable-pitch-font-weight))))
   `(warning      ((,class (:background ,n-富春紡 :foreground ,n-珈琲椶 :weight bold))))


   ;;; centaur-tabs
   `(centaur-tabs-default
     ((,class (:background ,n-米灰
                           :foreground ,n-墨))))
   `(centaur-tabs-selected
     ((,class (:background ,n-富春紡
                           :foreground ,n-墨))))
   `(centaur-tabs-selected-modified
     ((,class (:background ,n-富春紡
                           :foreground ,n-:slant italic))))
   `(centaur-tabs-unselected
     ((,class (:background ,n-春緑
                           :foreground ,n-墨灰))))
   `(centaur-tabs-unselected-modified
     ((,class (:background ,n-水黄
                           :foreground ,n-墨灰
                           :slant italic))))
   `(centaur-tabs-active-bar-face
     ((,class (:background ,n-墨))))



   ;;; company
   `(company-box-scrollbar
     ((,class (:background ,n/黛缟
                           :box (:line-width 2 :style released-button)
                           :extend t
                           :foreground ,n/缟黛))))
   `(company-box-selection
     ((,class (:inherit company-box-scrollbar))))
   `(company-echo-common
     ((,class (:background ,n-:foreground ,n-缟))))
   `(company-preview-common
     ((,class (:background ,n-:foreground ,n-:slant italic :weight bold))))
   `(company-scrollbar-bg
     ((,class (:background ,n-牙))))
   `(company-scrollbar-fg
     ((,class (:background ,n-:foreground ,n-缟))))
   `(company-tooltip
     ((,class (:background ,n/霜黛 :foreground ,n/黛霜))))
   `(company-tooltip-common
     ((,class (:background ,n-:foreground ,n-松绿 :weight bold))))
   `(company-tooltip-common-selection
     ((,class (:background ,n/黛缟 :foreground ,n-松花 :inherit company-tooltip-common))))
   `(company-tooltip-selection
     ((,class (:background ,n/黛缟
                           :box (:style released-button)
                           :extend t
                           :foreground ,n/缟黛))))

   ;;; counsel & ivy
   `(all-the-icons-ivy-rich-icon-face
     ((t (:box (:line-width 2 :style released-button)
               :inherit default))))
   `(ivy-current-match
     ((,class (:background ,n/黛缟
                           :extend t
                           :foreground ,n/缟墨
                           :weight bold))))
   `(ivy-highlight-face
     ((,class (:inherit counsel-active-mode))))
   `(ivy-minibuffer-match-face-1
     ((,class (:background ,n-松花
                           :foreground ,n-:weight bold))))
   `(ivy-minibuffer-match-face-2
     ((,class (:background ,n-鹅黄
                           :foreground ,n-:weight bold))))
   `(ivy-minibuffer-match-face-3
     ((,class (:background ,n-丁香
                           :foreground ,n-:weight bold))))
   `(ivy-minibuffer-match-face-4
     ((,class (:background ,n-火红
                           :foreground ,n-:weight bold))))

   ;;; customize faces
   `(custom-button
     ((,class (:box (:line-width 2 :style released-button)
                    :foreground ,n/霜黛
                    :background ,n/黛霜))))
   `(custom-button-mouse
     ((,class (:box (:line-width 2 :style released-button)
                    :background ,n/霜黛
                    :foreground ,n/黛霜))))
   `(custom-button-pressed
     ((,class (:box (:line-width 2 :style pressed-button)
                    :inherit custom-button))))
   `(custom-button-pressed-unraised
     ((,class (:foreground ,n-青莲 :inherit custom-button-unraised))))
   `(custom-button-unraised
     ((,class (:underline t))))
   `(custom-comment
     ((,class (:background ,n/霜黛 :foreground ,n/黛霜))))
   `(custom-group-tag
     ((,class (:foreground ,n-靛青
                           :height 1.4
                           :slant normal
                           :weight bold
                           :inherit variable-pitch))))
   `(custom-group-subtitle
     ((,class (:foreground ,n/墨缟
                           :height 1.2
                           :underline t
                           :weight bold))))
   `(custom-variable-obsolete
     ((,class (:foreground ,n/黛霜
                           :strike-through t))))
   `(custom-variable-tag
     ((,class (:foreground ,n-靛青
                           :slant normal
                           :weight bold))))

   ;;; dashboard
   `(dashboard-heading
     ((,class (:inherit font-lock-string-face :underline ,(--u? 'dash-string)))))
   `(widget-button
     ((,class (:weight unspecified))))

   ;;; display-fill-column-indicator-mode
   `(fill-column-indicator ((,class (:background ,n-湖藍 :foreground ,n-靛青))))


   ;;; flycheck
   `(flycheck-warning ((,class (:background ,n-:underline (:style wave :color ,n-丁香)))))

   ;;; font-lock faces
   `(font-lock-bracket-face
     ((,class (:foreground ,n-茶))))
   `(font-lock-builtin-face
     ((,class (:foreground ,n-:weight bold))))
   `(font-lock-comment-delimiter-face
     ((,class (:foreground ,n-:weight bold
                           :underline ,(--u? 'comment)))))
   `(font-lock-comment-face
     ((,class (:foreground ,n-:weight light
                           :slant italic
                           :underline ,(--u? 'comment)))))
   `(font-lock-constant-face
     ((,class (:foreground ,n-:underline ,(--u? 'constant)
                           :weight bold))))
   `(font-lock-delimiter-face
     ((,class (:foreground ,n-蒼翠
                           :background ,n/深深背景))))
   `(font-lock-doc-face
     ((,class (:background ,n-春緑 :foreground ,n-:weight light :extend t))))
   `(font-lock-doc-markup-face
     ((,class (:inherit font-lock-constant-face))))
   `(font-lock-escape-face
     ((,class (:foreground ,n-丁香))))
   `(font-lock-function-name-face
     ((,class (:background ,n/深背景 :foreground ,n-:weight bold))))
   `(font-lock-keyword-face
     ((,class (:foreground ,n-:weight bold
                           :underline ,(--u? 'keyword)))
      (,classd (:foreground ,n-:weight bold
                            :underline ,(--u? 'keyword)))))
   `(font-lock-misc-punctuation-face
     ((,class (:inherit font-lock-punctuation-face))))
   `(font-lock-negation-char-face
     ((,class (:foreground ,n-珈琲椶))))
   `(font-lock-number-face
     ((,class (:foreground ,n-深竹月))))
   `(font-lock-operator-face
     ((,class (:foreground ,n-羣青))))
   `(font-lock-preprocessor-face
     ((,class (:foreground ,n-紙棕 :slant italic))))
   `(font-lock-property-face
     ((,class (:foreground ,n-靛藍 :slant italic))))
   `(font-lock-punctuation-face
     ((,class (:foreground ,n-春辰))))
   `(font-lock-regexp-grouping-backslash
     ((,class (:background ,n-淡紫丁香))))
   `(font-lock-regexp-grouping-construct
     ((,class (:background ,n-淡紫丁香))))
   `(font-lock-string-face
     ((,class (:background ,n/淺背景 :foreground ,n-青青))))
   `(font-lock-type-face
     ((,class (:background ,n/深深背景
                          :foreground ,n-:slant italic
                          :weight bold))))
   `(font-lock-variable-name-face
     ((,class (:foreground ,n-:slant italic))))
   `(font-lock-warning-face
     ((,class (:background ,n-鸭黄 :foreground ,n-:weight bold))))

   ;;; highlight
   ;; highlight-indents-guide
   `(highlight-indent-guides-even-face
     ((,class (:background ,n-水黄))))
   `(highlight-indent-guides-odd-face
     ((,class (:background ,n-春緑))))
   ;; hl-line
   `(hl-line ((,class (:underline ,(--u? 'hl-line)
                                  ;; :background ,n-芽灰
                                  ;; :distant-foreground ,n-墨
                                  :extend t
                                  :weight bold))))

   ;;; minibuffer
   `(minibuffer-prompt ((,class (:foreground ,n-松绿 :weight bold
                                             :underline t))))

   ;;; mode line
   `(doom-modeline-battery-charging
     ((,class (:foreground ,n-寶藍))))
   `(doom-modeline-battery-full
     ((,class (:foreground ,n-松绿))))
   `(doom-modeline-buffer-file
     ((,class (:foreground ,n-:weight light))))
   `(doom-modeline-buffer-minor-mode
     ((,class (:inherit mode-line))))
   `(doom-modeline-buffer-modified
     ((,class (:foreground ,n-火红
                           :inherit mode-line
                           :weight bold))))
   `(doom-modeline-buffer-major-mode
     ((,class (:foreground ,n-火红 :weight light))))
   `(doom-modeline-buffer-path
     ((,class (:foreground ,n-:weight light))))
   `(doom-modeline-debug
     ((,class (:foreground ,n-:weight light))))
   `(doom-modeline-info
     ((,class (:foreground ,n-靛青
                           :inherit mode-line
                           :weight light))))
   `(doom-modeline-lsp-error
     ((,class (:inherit doom-modeline-urgent))))
   `(doom-modeline-lsp-running
     ((,class (:inherit doom-modeline-warning))))
   `(doom-modeline-lsp-warning
     ((,class (:inherit doom-modeline-warning))))
   `(doom-modeline-buffer-minor-mode
     ((,class (:inherit mode-line :background nil))))
   `(doom-modeline-project-dir
     ((,class (:foreground ,n-青青 :weight bold))))
   `(doom-modeline-urgent
     ((,class (:foreground ,n-品红
                           :inherit mode-line
                           :weight bold))))
   `(doom-modeline-warning
     ((,class (:foreground ,n-松花
                           :inherit mode-line
                           :weight bold))))
   `(mode-line          ((,class (:background ,n-胡粉 :weight light))))
   `(mode-line-inactive ((,class (:background ,n-:weight light))))

   ;;; orderless
   `(orderless-match-face-0
     ((,class (:background ,n-富春紡   :foreground ,n-蒼翠 :weight bold))))
   `(orderless-match-face-1
     ((,class (:background ,n-鳳仙粉   :foreground ,n-珈琲椶 :weight bold))))
   `(orderless-match-face-2
     ((,class (:background ,n-龍泉靑瓷 :foreground ,n-靛青   :weight bold))))
   `(orderless-match-face-3
     ((,class (:background ,n-紙棕     :foreground ,n-松绿   :weight bold))))

   ;;; org mode
   `(org-block
     ((,class (:background ,n/淺背景 :foreground ,n-:extend t))
      (,classd (:background ,nd/淺背景 :foreground ,n-:extend t))))
   `(org-block-begin-line
     ((,class (:background ,n-嬭油
                           :box (:line-width 1 :style released-button)
                           :extend t
                           :foreground ,n/墨缟
                           :weight bold
                           :slant italic))))
   `(org-cite-key
     ((,class (:foreground ,n-松绿))
      (,classd (:foreground ,n-蔥青))))
   `(org-code ((,class (:background ,n-米灰
                                    :foreground ,n-:inheit fixed-pitch))))
   `(org-document-title
     ((,class (:background ,n-富春紡
                           :extend t
                           :foreground ,n/墨缟
                           :height ,(--s? 1.7)
                           :weight bold))))
   `(org-document-info
     ((,class (:extend nil
                           :foreground ,n/墨缟
                           :height ,(--s? 1.2)
                           :slant italic))))
   `(org-document-info-keyword
     ((,class (:background ,n/素墨
                           :foreground ,n/墨缟
                           :height ,(--s? 1.2)
                           :slant italic))))
   `(org-done
     ((,class (:box (:line-width 2 :style released-button)
                    :foreground ,n/墨缟))))
   `(org-headline-done
     ((,class (:underline (:color ,n-松花)))))
   `(org-list-dt ((,class (:height ,(--s? 1.1) :weight bold))))
   `(org-meta-line
     ((,class (:inherit font-lock-comment-face
                        :underline nil))))
   `(org-property-value ((,class (:foreground ,n-松绿))))
   `(org-roam-link
     ((,class (:inherit org-link
                        :overline  t
                        :underline t))))
   `(org-special-keyword ((,class (:foreground ,n-深竹月))))
   `(org-superstar-header-bullet ((,class (:background ,n-富春紡))))
   `(org-superstar-item ((,class (:foreground ,n-靛青))))
   `(org-tag
     ((,class (:background ,n/牙黛
                           :box t
                           :foreground ,n/墨缟
                           :slant normal
                           :underline nil
                           :weight bold))))
   `(org-verbatim ((,class (:background ,n-春緑
                                        :foreground ,n-:inheit fixed-pitch))))

   ;;; Outline
   ;; Also the org-levels
   `(outline-1
     ((,class (:background ,n-:extend nil
                           :foreground ,n-靛青
                           :height ,(--s? 1.4)
                           :overline t
                           :weight bold))))
   `(outline-2
     ((,class (:background ,n-露玫瑰
                           :extend nil
                           :foreground ,n-紫扇貝
                           :height ,(--s? 1.2)
                           :overline t
                           :weight bold))))
   `(outline-3
     ((,class (:background ,n-春緑
                           :extend nil
                           :foreground ,n-松绿
                           :height ,(--s? 1.1)
                           :overline t
                           :weight bold))))
   `(outline-4
     ((,class (:background ,n-淡紫丁香
                           :extend nil
                           :foreground ,n/青莲丁香
                           :height ,(--s? 1.1)
                           :overline t
                           :weight bold))))
   `(outline-5
     ((,class (:extend t
                       :foreground ,n-靛青
                       :height ,(--s? 1.1)
                       :slant italic
                       :weight normal))))
   `(outline-6
     ((,class (:extend t
                       :foreground ,n-:height ,(--s? 1.1)
                       :slant italic
                       :weight normal))))
   `(outline-7
     ((,class (:extend t
                       :foreground ,n-松绿
                       :height ,(--s? 1.1)
                       :slant italic
                       :weight normal))))
   `(outline-8
     ((,class (:extend t
                       :foreground ,n/青莲丁香
                       :height ,(--s? 1.1)
                       :slant italic
                       :weight normal))))

   ;;; page break lines
   `(page-break-lines
     ((,class (:inherit font-lock-comment-face :slant normal :underline nil))))


   ;;; Show parens
   `(show-paren-match    ((,class (:background ,n-丁香))))
   `(show-paren-mismatch ((,class (:background ,n-鳳仙粉))))

   ;;; tab-line and tab-bar
   `(tab-line                               ((t (:inherit mode-line))))
   `(tab-line-tab                           ((t (:inherit mode-line))))
   `(tab-line-tab-inactive                  ((t (:inherit mode-line-inactive))))
   `(tab-line-tab-face-inactive-alternating ((t (:inherit mode-line-inactive))))
   `(tab-line-tab-current                   ((t (:inherit mode-line :foreground ,n-富春紡))))
   `(tab-line-highlight                     ((t (:inherit tab-line-tab))))

   `(tab-bar                ((t (:inherit tab-line))))
   `(tab-bar-tab            ((t (:inherit tab-line-tab))))
   `(tab-bar-tab-inactive   ((t (:inherit tab-line-tab-inactive))))

   ;;; term
   `(term-color-black   ((,class (:background ,n-:foreground ,n-墨))))
   `(term-color-blue    ((,class (:background ,n-靛青   :foreground ,n-靛青))))
   `(term-color-cyan    ((,class (:background ,n-湖藍   :foreground ,n-湖藍))))
   `(term-color-green   ((,class (:background ,n-松绿   :foreground ,n-松绿))))
   `(term-color-magenta ((,class (:background ,n-長萅蕐 :foreground ,n-長萅蕐))))
   `(term-color-red     ((,class (:background ,n-火红   :foreground ,n-火红))))
   `(term-color-white   ((,class (:background ,n-:foreground ,n-缟))))
   `(term-color-yellow  ((,class (:background ,n-紙棕   :foreground ,n-紙棕))))
   `(vterm-color-inverse-video
     ((,class (:background ,n-墨))))

   ;;; vertico
   `(vertico-mouse  ((,class (:background ,n-紙棕
                                          :inherit highlight))))

   ;;; which-func
   `(which-func  ((,class (:foreground ,n-青青 :weight light))))))

;;;###autoload
(and load-file-name
     (boundp 'custom-theme-load-path)
     (add-to-list 'custom-theme-load-path
                  (file-name-as-directory
                   (file-name-directory load-file-name))))

(provide-theme 'nasy)

3

3.1 Single Function to Center Emacs Window on Screen

;;;###autoload
(defun nasy/frame-recenter (&optional frame)
  "Center FRAME on the screen.
FRAME can be a frame name, a terminal name, or a frame.
If FRAME is omitted or nil, use currently selected frame."
  (interactive)
  (unless (eq 'maximised (frame-parameter nil 'fullscreen))
    (let* ((frame (or (and (boundp 'frame) frame) (selected-frame)))
           (frame-w (frame-pixel-width frame))
           (frame-h (frame-pixel-height frame))
            ;; frame-monitor-workarea returns (x y width height) for the monitor
           (monitor-w (nth 2 (frame-monitor-workarea frame)))
           (monitor-h (nth 3 (frame-monitor-workarea frame)))
           (center (list (/ (- monitor-w frame-w) 2)
                         (/ (- monitor-h frame-h) 2))))
      (apply 'set-frame-position (flatten-list (list frame center))))))

About

Nasy's Emacs 之寚


Languages

Language:Emacs Lisp 100.0%