       (goto-char (point-min))
       (snails-select-next-item)
       )))
+
+(defun snails-color-blend (c1 c2 alpha)
+  "Blend two colors C1 and C2 with ALPHA.
+C1 and C2 are hexidecimal strings.
+ALPHA is a number between 0.0 and 1.0 which corresponds to the
+influence of C1 on the result."
+  (apply #'(lambda (r g b)
+             (format "#%02x%02x%02x"
+                     (ash r -8)
+                     (ash g -8)
+                     (ash b -8)))
+         (cl-mapcar
+          (lambda (x y)
+            (round (+ (* x alpha) (* y (- 1 alpha)))))
+          (color-values c1) (color-values c2))))
+
+(defun snails-get-theme-colors ()
+  "We need adjust snails's colors when user switch new theme."
+  (let* ((white "#FFFFFF")
+         (black "#000000")
+         (bg-mode (frame-parameter nil 'background-mode))
+         (bg-unspecified (string= (face-background 'default) "unspecified-bg"))
+         (fg-unspecified (string= (face-foreground 'default) "unspecified-fg"))
+         (fg (cond
+              ((and fg-unspecified (eq bg-mode 'dark)) "gray80")
+              ((and fg-unspecified (eq bg-mode 'light)) "gray20")
+              (t (face-foreground 'default))))
+         (bg (cond
+              ((and bg-unspecified (eq bg-mode 'dark)) "gray20")
+              ((and bg-unspecified (eq bg-mode 'light)) "gray80")
+              (t (face-background 'default))))
+         ;; for light themes
+         (bg-dark (snails-color-blend black bg 0.1))
+         (bg-more-dark (snails-color-blend black bg 0.25))
+         (fg-dark (snails-color-blend fg bg-dark 0.7))
+         (fg-more-dark (snails-color-blend black fg 0.3))
+         ;; for dark themes
+         (bg-light (snails-color-blend white bg 0.05))
+         (bg-more-light (snails-color-blend white bg 0.1))
+         (fg-light (snails-color-blend fg bg 0.7))
+         (fg-more-light (snails-color-blend white fg 0.3)))
+    (cond
+     ((eq bg-mode 'dark)
+      (list bg-light fg-dark bg-more-light fg-more-light))
+     (t
+      (list bg-dark fg-light bg-more-dark fg-more-dark)
+      ))))
 
 (defun snails-jump-to-next-item ()
   "Select next candidate item."

;; Maintainer: Andy Stewart <lazycat.manatee@gmail.com>
;; Copyright (C) 2019, Andy Stewart, all rights reserved.
;; Created: 2019-05-16 21:26:09
;; Version: 1.9
;; Last-Updated: 2019-07-23 15:49:00
;;           By: Andy Stewart
;; URL: http://www.emacswiki.org/emacs/download/snails.el
;; Keywords:

;; 2019/07/23
;;      * Kill old subprocess immediately, don't wait `run-with-idle-timer'
;;      * Split input window with on line height.
;;      * Make color along with current theme.
;;
;; 2019/07/22
;;      * Delete other window first, make sure only one window in frame.
