From 0e6c15bbaf14e92df44a3ea0fd2716527cbb2d5f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sat, 24 Sep 2022 20:08:25 +0200 Subject: [PATCH] image-dired: Add faces for header line * lisp/image/image-dired.el (image-dired-thumb-header-file-name) (image-dired-thumb-header-directory-name) (-image-dired-thumb-header-file-size) (image-dired-thumb-header-image-count): New faces. (image-dired-format-properties-string): Use above new faces. (image-dired-thumb-mark, image-dired-thumb-flagged): Move definition further down. --- etc/NEWS | 9 +++++ lisp/image/image-dired.el | 83 ++++++++++++++++++++++++++++----------- 2 files changed, 68 insertions(+), 24 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 1816dd716a8..74e29a0ea59 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -2128,6 +2128,15 @@ old format, add this to your Init file: (setopt image-dired-display-properties-format "%b: %f (%t): %c") +--- +*** New faces for the header line of the thumbnail buffer. +These faces correspond to different parts of the header line, as +specified in 'image-dired-display-properties-format': +- 'image-dired-thumb-header-file-name' +- 'image-dired-thumb-header-directory-name' +- 'image-dired-thumb-header-file-size' +- 'image-dired-thumb-header-image-count' + --- *** PDF support. Image-Dired now displays thumbnails for PDF files. Type 'RET' on a diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 080c2536af0..c519b326545 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -259,22 +259,6 @@ deletion." :type 'boolean :version "28.1") -(defface image-dired-thumb-mark - '((((class color) (min-colors 16)) :background "DarkOrange") - (((class color)) :foreground "yellow")) - "Face for marked images in thumbnail buffer." - :version "29.1") - -(defface image-dired-thumb-flagged - '((((class color) (min-colors 88) (background light)) :background "Red3") - (((class color) (min-colors 88) (background dark)) :background "Pink") - (((class color) (min-colors 16) (background light)) :background "Red3") - (((class color) (min-colors 16) (background dark)) :background "Pink") - (((class color) (min-colors 8)) :background "red") - (t :inverse-video t)) - "Face for images flagged for deletion in thumbnail buffer." - :version "29.1") - (defcustom image-dired-line-up-method 'dynamic "Default method for line-up of thumbnails in thumbnail buffer. Used by `image-dired-display-thumbs' and other functions that needs @@ -362,6 +346,52 @@ This affects the following commands: :type 'boolean :version "29.1") + +;;; Faces + +;;;; Header line + +(defface image-dired-thumb-header-file-name + '((default :weight bold)) + "Face for the file name in the header line of the thumbnail buffer." + :version "29.1") + +(defface image-dired-thumb-header-directory-name + '((default :inherit header-line)) + "Face for the directory name in the header line of the thumbnail buffer." + :version "29.1") + +(defface -image-dired-thumb-header-file-size + '((((class color) (min-colors 88)) :foreground "cadet blue") + (((class color) (min-colors 16)) :foreground "black") + (default :inherit header-line)) + "Face for the file size in the header line of the thumbnail buffer." + :version "29.1") + +(defface image-dired-thumb-header-image-count + '((default :inherit header-line)) + "Face for the image count in the header line of the thumbnail buffer." + :version "29.1") + +;;;; Thumbnail buffer + +(defface image-dired-thumb-mark + '((((class color) (min-colors 16)) :background "DarkOrange") + (((class color)) :foreground "yellow") + (default :inherit header-line)) + "Face for marked images in thumbnail buffer." + :version "29.1") + +(defface image-dired-thumb-flagged + '((((class color) (min-colors 88) (background light)) :background "Red3") + (((class color) (min-colors 88) (background dark)) :background "Pink") + (((class color) (min-colors 16) (background light)) :background "Red3") + (((class color) (min-colors 16) (background dark)) :background "Pink") + (((class color) (min-colors 8)) :background "red") + (t :inverse-video t)) + "Face for images flagged for deletion in thumbnail buffer." + :version "29.1") + ;;; Util functions @@ -731,14 +761,19 @@ comment." (format-spec image-dired-display-properties-format `((?b . ,(or buf "")) - (?d . ,(file-name-nondirectory - (directory-file-name - (file-name-directory file)))) - (?f . ,(file-name-nondirectory file)) - (?n . ,image-count) - (?s . ,(file-size-human-readable - (file-attribute-size - (file-attributes file)))) + (?d . ,(propertize + (file-name-nondirectory + (directory-file-name + (file-name-directory file))) + 'face 'image-dired-thumb-header-directory-name)) + (?f . ,(propertize (file-name-nondirectory file) + 'face 'image-dired-thumb-header-file-name)) + (?n . ,(propertize image-count + 'face 'image-dired-thumb-header-image-count)) + (?s . ,(propertize (file-size-human-readable + (file-attribute-size + (file-attributes file))) + 'face 'image-dired-thumb-header-file-size)) (?t . ,(or props "")) (?c . ,(or comment ""))))) -- 2.39.2