branch: elpa/dracula-theme
commit 75316aa1ef1d49207b4a57ac3b3ff8e4313dad02
Author: Étienne Deparis <[email protected]>
Commit: Étienne Deparis <[email protected]>
Begin to work on terminal colors fix
---
dracula-theme.el | 60 +++++++++++++++++++++++++++--------------------------
start_emacs_test.sh | 20 ++++++++++++++++++
test-profile.el | 4 ++++
3 files changed, 55 insertions(+), 29 deletions(-)
diff --git a/dracula-theme.el b/dracula-theme.el
index a5a71e9..dbf0cf2 100644
--- a/dracula-theme.el
+++ b/dracula-theme.el
@@ -19,25 +19,25 @@
;; Assigment form: VARIABLE COLOR [TTY-COLOR]
(let ((colors '(;; Upstream theme color
- (dracula-bg "#282a36" nil) ; official background
- (dracula-current "#44475a") ; official current-line/selection
- (dracula-fg "#f8f8f2") ; official foreground
- (dracula-comment "#6272a4") ; official comment
- (dracula-cyan "#8be9fd") ; official cyan
- (dracula-green "#50fa7b") ; official green
- (dracula-orange "#ffb86c") ; official orange
- (dracula-pink "#ff79c6") ; official pink
- (dracula-purple "#bd93f9") ; official purple
- (dracula-red "#ff5555") ; official red
- (dracula-yellow "#f1fa8c") ; official yellow
+ (dracula-bg "#282a36" "#262626" nil) ;
official background
+ (dracula-current "#44475a" "#262626" "brightblack") ;
official current-line/selection
+ (dracula-fg "#f8f8f2" "white" "white") ;
official foreground
+ (dracula-comment "#6272a4" "#525252" "blue") ;
official comment
+ (dracula-cyan "#8be9fd" "#88eeff" "brightcyan") ;
official cyan
+ (dracula-green "#50fa7b" "#55ff77" "green") ;
official green
+ (dracula-orange "#ffb86c" "#ffbb66" "brightred") ;
official orange
+ (dracula-pink "#ff79c6" "#ff77cc" "magenta") ;
official pink
+ (dracula-purple "#bd93f9" "#bb99ff" "brightmagenta") ;
official purple
+ (dracula-red "#ff5555" "#ff6655" "red") ;
official red
+ (dracula-yellow "#f1fa8c" "#ffff88" "yellow") ;
official yellow
;; Other colors
- (bg2 "#373844")
- (bg3 "#464752")
- (bg4 "#565761")
- (fg2 "#e2e2dc")
- (fg3 "#ccccc7")
- (fg4 "#b6b6b2")
- (other-blue "#0189cc")))
+ (bg2 "#373844" "#2e2e2e" "brightblack")
+ (bg3 "#464752" "#262626" "brightblack")
+ (bg4 "#565761" "#3f3f3f" "brightblack")
+ (fg2 "#e2e2dc" "#bfbfbf" "brightwhite")
+ (fg3 "#ccccc7" "#cccccc" "white")
+ (fg4 "#b6b6b2" "#bbbbbb" "white")
+ (other-blue "#0189cc" "#0088cc" "brightblue")))
(faces '(;; default
(cursor :background ,fg3)
(default :background ,dracula-bg :foreground ,dracula-fg)
@@ -511,17 +511,19 @@
'dracula
(let ((color-names (mapcar #'car colors))
(graphic-colors (mapcar #'cadr colors))
- (tty-colors (mapcar #'car (mapcar #'last colors))))
- (cl-flet* ((expand-for-tty (spec) (cl-progv color-names tty-colors
- (eval `(backquote ,spec))))
- (expand-for-graphic (spec) (cl-progv color-names
graphic-colors
- (eval `(backquote ,spec)))))
- (cl-loop for (face . spec) in faces
- collect `(,face
- ((((min-colors 16777216))
- ,(expand-for-graphic spec))
- (t
- ,(expand-for-tty spec)))))))))
+ (term-colors (mapcar #'car (mapcar #'cddr colors)))
+ (tty-colors (mapcar #'car (mapcar #'last colors)))
+ (expand-for-kind (lambda (kind spec)
+ (cl-progv color-names kind
+ (eval `(backquote ,spec))))))
+ (cl-loop for (face . spec) in faces
+ collect `(,face
+ ((((min-colors 16777216)) ; fully graphical envs
+ ,(funcall expand-for-kind graphic-colors spec))
+ (((min-colors 256)) ; terminal withs 256
colors
+ ,(funcall expand-for-kind term-colors spec))
+ (t ; should be only
tty-like envs
+ ,(funcall expand-for-kind tty-colors
spec))))))))
;;;###autoload
(when load-file-name
diff --git a/start_emacs_test.sh b/start_emacs_test.sh
new file mode 100755
index 0000000..2e87fcd
--- /dev/null
+++ b/start_emacs_test.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env sh
+
+ARGS=
+TERM_TEST=no
+COLOR=256color
+
+for arg in $*; do
+ case $arg in
+ 256) COLOR=256color ;;
+ 88) COLOR=88color ;;
+ 16) COLOR=16color ;;
+ *)
+ [ "$arg" = '-nw' ] && TERM_TEST=yes
+ ARGS="$ARGS $arg"
+ ;;
+ esac
+done
+
+[ "$TERM_TEST" = 'yes' ] && export TERM=xterm-$COLOR
+emacs -Q --debug-init -l test-profile.el $ARGS
diff --git a/test-profile.el b/test-profile.el
new file mode 100644
index 0000000..a5822f9
--- /dev/null
+++ b/test-profile.el
@@ -0,0 +1,4 @@
+(advice-add #'x-apply-session-resources :override #'ignore)
+
+(load-file "dracula-theme.el")
+(load-theme 'dracula t)