diff --git a/README.md b/README.md index 4b90c6a..0cf6e33 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ Or you can bind it globally to replace `goto-line`: (global-set-key [remap goto-line] 'goto-line-preview) ``` -## Change hightlight color or duration +### Change hightlight color or duration ```el ;; Highlight 1.5 seconds when change preview line (setq goto-line-preview-hl-duration 1.5) ;; Change highlight background color to white -(setq goto-line-preview-hl-color "white") +(set-face-background 'goto-line-preview-hl "white") ``` If you want to close highlight, set `goto-line-preview-hl-duration` to 0 or `nil`. diff --git a/goto-line-preview.el b/goto-line-preview.el index 2af3ae9..ede2663 100644 --- a/goto-line-preview.el +++ b/goto-line-preview.el @@ -53,10 +53,10 @@ :group 'goto-line-preview :type 'integer) -(defcustom goto-line-preview-hl-color "DimGray" - "Background color of highlight when change preview line." - :group 'goto-line-preview - :type 'string) +(defface goto-line-preview-hl + '((t :inherit highlight)) + "Face to use for highlighting when change preview line." + :group 'goto-line-preview) (defvar goto-line-preview--prev-window nil "Record down the previous window before we do preivew display.") @@ -71,7 +71,7 @@ "Keep highlight for a fixed time." (when goto-line-preview-hl-duration (let ((overlay (make-overlay (line-beginning-position) (line-end-position)))) - (overlay-put overlay 'face `(:background ,goto-line-preview-hl-color)) + (overlay-put overlay 'face 'goto-line-preview-hl) (sit-for goto-line-preview-hl-duration) (delete-overlay overlay))))