[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/moe-theme b2d3e2f5bf 022/352: New moe-theme-switcher.el th
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/moe-theme b2d3e2f5bf 022/352: New moe-theme-switcher.el that can switch theme by locale longitide and latitude. Holy Yes! |
Date: |
Fri, 7 Jan 2022 03:59:02 -0500 (EST) |
branch: elpa/moe-theme
commit b2d3e2f5bf1f27b07a063cb3fe0dcb27b8b9614f
Author: kuanyui <azazabc123@gmail.com>
Commit: kuanyui <azazabc123@gmail.com>
New moe-theme-switcher.el that can switch theme by locale longitide and
latitude. Holy Yes!
---
README.md | 8 +++-
moe-theme-switcher.el | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 9c8cf91597..695dc45c0a 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,12 @@
Just another Emacs theme.
![Screenshot](https://github.com/kuanyui/moe-theme.el/raw/master/pics/screenshot.png)
This theme supports Emacs 24 native theme.
+# What Special?
+* Delightful and cheerful color-platte.
+* Quite completed font-faces.
+*
# Support
-`moe-theme.el` provide good-looking[tm] and quite fully-supported font-faces
include:
+`moe-theme.el` provide good-looking[tm] and quite fully-supported font-faces
for various modes, include:
* Dired/Dired+
* Helm
* Org-mode
@@ -74,4 +78,4 @@ The mode you're using has an ugly looking? `Moe-theme`
doesn't support the mode
* When type characters with IM (e.g. fcitx), and run Emacs under terminal
emulator (e.g. Konsole) with `moe-light-theme`; when you type words in IM, the
string embedded in Emacs may be very insignificant (But as you output the word
from IM, it turns normal).
## License
-`moe-theme.el` (include images) is released under GPL v3.
+`moe-theme.el` (include images) is released under GPL v3. Copyleft is so cute!
diff --git a/moe-theme-switcher.el b/moe-theme-switcher.el
new file mode 100644
index 0000000000..3d75605ede
--- /dev/null
+++ b/moe-theme-switcher.el
@@ -0,0 +1,106 @@
+;; moe-theme-switcher.el
+;; Author: kuanyui (azazabc123@gmail.com)
+;; Date: 2013/05/11 11:39
+;;
+;; This file is not a part of GNU Emacs,
+;; but this file is released under GPL v3.
+
+(require 'moe-dark-theme)
+(require 'moe-light-theme)
+
+(defvar moe-theme-switch-by-sunrise-and-sunset t
+"Automatically switch between dark and light moe-theme.
+
+If this value is nil, moe-theme will switch at fixed time (06:00 and 18:00).
+
+If this value is t and both calendar-latitude and calendar-longitude are set
properly, the switching will be triggered at the sunrise and sunset time of the
local calendar.
+
+Take Keelung, Taiwan(25N,121E) for example, you can set like this:
+
+ (setq calendar-latitude +25)
+ (setq calendar-longitude +121)"
+)
+
+(defun switch-at-fixed-time ()
+ (let ((now (string-to-int (format-time-string "%H"))))
+ (if (and (>= now 06) (<= now 18))
+ (load-theme 'moe-light t) (load-theme 'moe-dark t))
+ nil))
+
+;; Convert am/pm to 24hr and save to 24h/sunrise & 24h/set
+;; Excute every 24 hr
+(defun convert-time-format-of-sunrise-and-sunset ()
+ (let (rise_set a b c d e f)
+ (setq rise_set (sunrise-sunset))
+ (if (string-match "0:00 hours daylight" rise_set) ;If polar-night
+ (progn
+ (setq 24h/sunrise 'polar-night
+ 24h/sunset 'polar-night))
+ (if (string-match "24:00 hours daylight" rise_set) ;If midnight-sun
+ (progn
+ (setq 24h/sunrise 'midnight-sun
+ 24h/sunset 'midnight-sun))
+ (progn
+ (string-match
"\\([0-9][0-9]?\\):\\([0-9][0-9]\\)\\([ap]m\\).+\\([0-9][0-9]?\\):\\([0-9][0-9]\\)\\([ap]m\\)"
rise_set)
+ (setq a (string-to-number (match-string 1 rise_set))
+ b (string-to-number (match-string 2 rise_set))
+ c (match-string 3 rise_set)
+ d (string-to-number (match-string 4 rise_set))
+ e (string-to-number (match-string 5 rise_set))
+ f (match-string 6 rise_set))
+ (if (equal c "pm")
+ (setq 24h/sunrise (list (+ 12 a) b))
+ (setq 24h/sunrise (list a b)))
+ (if (equal f "pm")
+ (setq 24h/sunset (list (+ 12 d) e))
+ (setq 24h/sunset (list d e))))))))
+
+;; Excute every minute.
+(defun switch-by-locale ()
+ (if (equal 24h/sunrise 'polar-night) ;If polar-night...moe-dark!
+ (load-theme 'moe-dark t)
+ (if (equal 24h/sunrise 'midnight-sun) ;If midnight-sun...moe-light!
+ (load-theme 'moe-light t)
+ (progn
+ (let ((now (list (string-to-number (format-time-string "%H"))
+ (string-to-number (format-time-string "%M")))))
+ (if (and (or ;magic-logic [tm]
+ (> (car now) (car 24h/sunrise))
+ (and
+ (= (car now) (car 24h/sunrise))
+ (>= (second now) (second 24h/sunrise))))
+ (or
+ (< (car now) (car 24h/sunset))
+ (and
+ (= (car now) (car 24h/sunset))
+ (< (second now) (second 24h/sunset)))))
+ (load-theme 'moe-light t)
+ (load-theme 'moe-dark t)
+ ))))))
+
+(defun moe-theme-auto-switch ()
+ (interactive)
+ (if (boundp '24h/sunrise)
+ (switch-by-locale)
+ (switch-at-fixed-time))
+ )
+
+(if (and
+ (boundp 'calendar-longitude)
+ (boundp 'calendar-latitude)
+ (eql moe-theme-switch-by-sunrise-and-sunset t))
+ (progn
+ (convert-time-format-of-sunrise-and-sunset)
+ (run-with-timer 0 (* 60 60 24)
'convert-time-format-of-sunrise-and-sunset))
+ ()
+ )
+
+
+(moe-theme-auto-switch)
+
+(run-with-timer 0 (* 1 60) 'moe-theme-auto-switch)
+
+(provide 'moe-theme-switcher)
+
+
+
- [nongnu] elpa/moe-theme 9c4ffbca32 001/352: 1. First commit, (continued)
- [nongnu] elpa/moe-theme 9c4ffbca32 001/352: 1. First commit, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 1836d08410 003/352: 1. Beautify Markdown-mode faces of moe-light., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme a3d249f539 005/352: 1. Enlarge Markdown's header height, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme da30edd39b 006/352: 1. Dired+ works, but still some flaws., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme ab51320cbc 010/352: 1. Some bugs fix, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme d12dc7812c 014/352: 1. Add Magit support for moe-dark (Not include moe-light)., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0090747615 015/352: 1. Full support for Magit =w=+, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 8389c37d4d 004/352: 1. Improve the face for paren and hl-line., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 4981ae7f9c 007/352: 1. Dired+ works well in moe-dark and moe-light., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 507e2d0e27 008/352: 1. Major changes in background and normal font theme., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme b2d3e2f5bf 022/352: New moe-theme-switcher.el that can switch theme by locale longitide and latitude. Holy Yes!,
ELPA Syncer <=
- [nongnu] elpa/moe-theme 669da2b186 047/352: 1. Fixed (maybe...) wrong background and foreground color under GUI version Emacs. 2. Update README #Known Issue, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme fe67076723 030/352: 1. Bigger banner raw., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 6736e3d569 045/352: 1. Correct and translate some comments., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme c8e0e68354 009/352: 1. Add Rainbow-delimiters, ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 585dfe4c61 018/352: 1. Fix invisible org's todo/done under hl-line., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 64aaeb33ca 035/352: 1. Lisp in GitHub markdown., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme cb14d6e6fe 053/352: 1. it seems -pkg.el goes wrong., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 4234d66184 066/352: Todo list., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 7e569065c4 067/352: typo., ELPA Syncer, 2022/01/07
- [nongnu] elpa/moe-theme 0bdea86acc 069/352: Add faces for yalinum.el, ELPA Syncer, 2022/01/07