すべての themeでスクリーンキャプチャを撮影する
全部の thumeで色を見比べたいなぁと思ったので、
そんなコードを書いてみました。
コード
X Window System限定です。
;;; capture-all-theme.el --- ;; Copyright (C) 2012 by Syohei YOSHIDA ;; Author: Syohei YOSHIDA <syohex@gmail.com> ;; URL: ;; Version: 0.01 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;;; Code: (eval-when-compile (require 'cl)) (defun ca-theme:current-window-id () (with-temp-buffer (let ((cmd "xprop -root") (regexp "_NET_ACTIVE_WINDOW(WINDOW): window id # \\([^,]+\\)")) (call-process-shell-command cmd nil t) (goto-char (point-min)) (if (re-search-forward regexp nil t) (match-string-no-properties 1) (error "Can't get current window id"))))) (defun ca-theme:load-theme (theme) (mapc (lambda (th) (disable-theme th)) custom-enabled-themes) (load-theme theme t)) (defun capture-all-theme () (interactive) (let ((id (ca-theme:current-window-id))) (loop for theme in (custom-available-themes) for output = (format "%s.png" theme) for cmd = (format "import -frame -window %s %s" id output) do (progn (message "%s" cmd) (ca-theme:load-theme theme) (redisplay t) (call-process-shell-command cmd) (sleep-for 0.5))))) ;;; capture-all-theme.el ends here
実行
キャプチャを撮りたいバッファで以下を実行してください。
M-x capture-all-theme
実行にあたり
さすがに画面から見えない部分はちゃんと描画してくれないようで
該当のウィンドウをアクティブが見える状態にしておく必要が
ありました。他の作業しつつ取れるかなって思ったんですが、
それは無理でした。トイレへ行く前ぐらいに実行しておくと
いいかもしれません。