[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ef-themes 7387c90219 02/10: Make ef-themes-load-random
From: |
ELPA Syncer |
Subject: |
[elpa] externals/ef-themes 7387c90219 02/10: Make ef-themes-load-random optional limit light/dark |
Date: |
Tue, 16 Aug 2022 23:57:34 -0400 (EDT) |
branch: externals/ef-themes
commit 7387c90219dda179685a11258b1ca60ab1723d29
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>
Make ef-themes-load-random optional limit light/dark
---
ef-themes.el | 40 +++++++++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 9 deletions(-)
diff --git a/ef-themes.el b/ef-themes.el
index c0ebab1df7..ce855788f5 100644
--- a/ef-themes.el
+++ b/ef-themes.el
@@ -92,21 +92,43 @@
(defun ef-themes-select (theme)
"Load an Ef THEME using minibuffer completion.
When called from Lisp, THEME is a symbol."
- (interactive
- (list (intern (ef-themes--select-prompt))))
+ (interactive (list (intern (ef-themes--select-prompt))))
(mapc #'disable-theme (ef-themes--list-known-themes))
(load-theme theme :no-confirm))
-(defun ef-themes--minus-current ()
- "Return list of Ef themes minus the current one."
- (let* ((themes (copy-sequence (ef-themes--list-known-themes))))
+(defun ef-themes--minus-current (&optional variant)
+ "Return list of Ef themes minus the current one.
+VARIANT is either `light' or `dark', which stand for
+`ef-themes-light-themes' and `ef-themes-dark-themes',
+respectively. Else check against the return value of
+`ef-themes--list-known-themes'."
+ (let* ((list (when variant
+ (if (eq variant 'dark)
+ ef-themes-dark-themes
+ ef-themes-light-themes)))
+ (sequence (or list (ef-themes--list-known-themes)))
+ (themes (copy-sequence sequence)))
(delete (ef-themes--current-theme) themes)))
+(defconst ef-themes-light-themes '(ef-day ef-light ef-spring ef-summer)
+ "List of symbols with the light Ef themes.")
+
+(defconst ef-themes-dark-themes '(ef-autumn ef-dark ef-night ef-winter)
+ "List of symbols with the dark Ef themes.")
+
;;;###autoload
-(defun ef-themes-load-random ()
- "Load an Ef theme at random, excluding the current one."
- (interactive)
- (let* ((themes (ef-themes--minus-current))
+(defun ef-themes-load-random (&optional variant)
+ "Load an Ef theme at random, excluding the current one.
+With optional VARIANT as either `light' or `dark', limit the set
+to the relevant themes.
+
+When called interactively, VARIANT is the prefix argument which
+prompts with completion for either `light' or `dark'."
+ (interactive
+ (list (when current-prefix-arg
+ (intern (completing-read "Random choice of Ef themes VARIANT: "
+ '(light dark) nil t)))))
+ (let* ((themes (ef-themes--minus-current variant))
(n (random (length themes)))
(pick (nth n themes)))
(mapc #'disable-theme (ef-themes--list-known-themes))
- [elpa] externals/ef-themes updated (23b342f06a -> 48fc63f767), ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes e15123e1dc 01/10: Add ef-themes-load-random command, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes 7387c90219 02/10: Make ef-themes-load-random optional limit light/dark,
ELPA Syncer <=
- [elpa] externals/ef-themes ae9512f7c0 06/10: ef-day: change docstring mapping to cyan variant, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes f500017eac 08/10: ef-autumn: tweak {green, blue, cyan}-faint, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes 9e8d6ac183 09/10: ef-autumn: tweak bg-info, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes 310c3ea04a 03/10: ef-night: tweak cursor hue, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes e547eeeef0 04/10: ef-day: tweak blue-faint, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes 2a9c62b906 05/10: ef-day: tweak cyan-faint, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes 4de0999f53 07/10: Update contrast ratio table for ef-day, ELPA Syncer, 2022/08/16
- [elpa] externals/ef-themes 48fc63f767 10/10: Bump version to 0.0.2 (NOT ACTUAL RELEASE), ELPA Syncer, 2022/08/16