Browse Source

Decide hl-line color randomly

master
10sr 5 years ago
parent
commit
dae2f9a9ca
Signed by: 10sr GPG Key ID: 7BEC428194130EB2
1 changed files with 32 additions and 21 deletions
  1. +32
    -21
      emacs.el

+ 32
- 21
emacs.el View File

@@ -769,13 +769,24 @@ found, otherwise returns nil."
'(safe-require-or-eval 'fill-column-indicator) '(safe-require-or-eval 'fill-column-indicator)
(setq fill-column-indicator)) (setq fill-column-indicator))


(defun my-gen-hl-line-color-dark ()
"Generate color for current line in black background."
(let* ((candidates (mapcar 'number-to-string (number-sequence 0 6)))
(limit (length candidates)))
(format "#%s%s%s"
(nth (random limit) candidates)
(nth (random limit) candidates)
(nth (random limit) candidates)
)))
;; (my-gen-hl-line-color-dark)

;; highlight current line ;; highlight current line
;; http://wiki.riywo.com/index.php?Meadow ;; http://wiki.riywo.com/index.php?Meadow
(face-spec-set 'hl-line (face-spec-set 'hl-line
'((((min-colors 256)
`((((min-colors 256)
(background dark)) (background dark))
;; Rotate midnightblue ;; Rotate midnightblue
(:background "#701919"))
(:background ,(my-gen-hl-line-color-dark)))
(((min-colors 256) (((min-colors 256)
(background light)) (background light))
;; TODO: What is should be? ;; TODO: What is should be?
@@ -860,25 +871,25 @@ found, otherwise returns nil."
;; Use gfind if available? ;; Use gfind if available?
"find")) "find"))
(findcmd (concat "set -eu; set -o pipefail; " (findcmd (concat "set -eu; set -o pipefail; "
"echo .; "
"echo ..; "
"command " find " -L . "
"-mindepth 1 "
"\\( -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune "
"-o -print "
"2> /dev/null "
"| "
"cut -b3-"))
(fdcmd (concat "set -eu; set -o pipefail; "
"echo .; "
"echo ..; "
"command fd "
"--follow --hidden --no-ignore "
"--color always "
"2>/dev/null")))
(if (executable-find "fd")
(setenv "FZF_DEFAULT_COMMAND" fdcmd)
(setenv "FZF_DEFAULT_COMMAND" findcmd)))
"echo .; "
"echo ..; "
"command " find " -L . "
"-mindepth 1 "
"\\( -fstype 'sysfs' -o -fstype 'devfs' -o -fstype 'devtmpfs' -o -fstype 'proc' \\) -prune "
"-o -print "
"2> /dev/null "
"| "
"cut -b3-"))
(fdcmd (concat "set -eu; set -o pipefail; "
"echo .; "
"echo ..; "
"command fd "
"--follow --hidden --no-ignore "
"--color always "
"2>/dev/null")))
(if (executable-find "fd")
(setenv "FZF_DEFAULT_COMMAND" fdcmd)
(setenv "FZF_DEFAULT_COMMAND" findcmd)))
(set-variable 'fzf/window-height 45) (set-variable 'fzf/window-height 45)
(set-variable 'fzf/args "--print-query --ansi --color='bg+:-1' --inline-info --cycle") (set-variable 'fzf/args "--print-query --ansi --color='bg+:-1' --inline-info --cycle")
;; (set-variable 'fzf/args "--print-query --ansi --inline-info --cycle") ;; (set-variable 'fzf/args "--print-query --ansi --inline-info --cycle")


Loading…
Cancel
Save