From 18413a1392f3ae771813cb19d456f65d9f09bb6e Mon Sep 17 00:00:00 2001 From: Nicolas Petton Date: Thu, 22 Sep 2016 10:37:19 +0200 Subject: [PATCH] Initial support for 256 colors (terminal) --- zerodark-theme.el | 66 ++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/zerodark-theme.el b/zerodark-theme.el index b646870..3b58cf5 100644 --- a/zerodark-theme.el +++ b/zerodark-theme.el @@ -34,38 +34,44 @@ :type 'boolean :group 'zerodark) +(defun true-color-p () + (or + (display-graphic-p) + (= (tty-display-color-cells) 16777216))) + + (let ((class '((class color) (min-colors 89))) - (default "#abb2bf") - (light "#ccd4e3") - (background "#282c34") - (background-darker "#21252b") - (background-lighter "#3a3f4b") - (background-red "#4c3840") - (background-purple "#48384c") - (background-blue "#38394c") - (background-green "#3d4a41") - (background-orange "#4a473d") - (hl-line "#2c323b") - (grey "#cccccc") - (grey-dark "#666666") - (highlight "#3e4451") - (comment "#687080") - (orange "#da8548") - (orange-light "#ddbd78") - (red "#ff6c6b") - (purple "#c678dd") - (purple-dark "#64446d") - (blue "#61afef") - (blue-dark "#1f5582") - (green "#98be65") - (green-light "#9eac8c") + (default (if (true-color-p) "#abb2bf" "#afafaf")) + (light (if (true-color-p) "#ccd4e3" "#d7d7d7")) + (background (if (true-color-p) "#282c34" "#333333")) + (background-darker (if (true-color-p) "#21252b" "#222222")) + (background-lighter (if (true-color-p) "#3a3f4b" "#5f5f5f")) + (background-red (if (true-color-p) "#4c3840" "#5f5f5f")) + (background-purple (if (true-color-p) "#48384c" "#5f5f5f")) + (background-blue (if (true-color-p) "#38394c" "#444444")) + (background-green (if (true-color-p) "#3d4a41" "#5f5f5f")) + (background-orange (if (true-color-p) "#4a473d" "#5f5f5f")) + (hl-line (if (true-color-p) "#2c323b" "#333333")) + (grey (if (true-color-p) "#cccccc" "#cccccc")) + (grey-dark (if (true-color-p) "#666666" "#666666")) + (highlight (if (true-color-p) "#3e4451" "#5f5f5f")) + (comment (if (true-color-p) "#687080" "#707070")) + (orange (if (true-color-p) "#da8548" "#d7875f")) + (orange-light (if (true-color-p) "#ddbd78" "#d7af87")) + (red (if (true-color-p) "#ff6c6b" "#ff5f5f")) + (purple (if (true-color-p) "#c678dd" "#d787d7")) + (purple-dark (if (true-color-p) "#64446d" "#5f5f5f")) + (blue (if (true-color-p) "#61afef" "#5fafff")) + (blue-dark (if (true-color-p) "#1f5582" "#005f87")) + (green (if (true-color-p) "#98be65" "#87af5f")) + (green-light (if (true-color-p) "#9eac8c" "#afaf87")) (peach "PeachPuff3") - (diff-added-background "#284437") - (diff-added-refined-background "#198754") - (diff-removed-background "#553333") - (diff-removed-refined-background "#981b1b") - (diff-current-background "#3e4d58") - (diff-current-refined-background "#456981")) + (diff-added-background (if (true-color-p) "#284437" "#284437")) + (diff-added-refined-background (if (true-color-p) "#1987;54" "#00875f")) + (diff-removed-background (if (true-color-p) "#583333" "#580000")) + (diff-removed-refined-background (if (true-color-p) "#981b1b" "#870000")) + (diff-current-background (if (true-color-p) "#3e4d58" "#5f;5f5f")) + (diff-current-refined-background (if (true-color-p) "#456981" "#5f5f87"))) (custom-theme-set-faces 'zerodark `(default ((,class (:background ,background :foreground ,default))))