Skip to content

Commit

Permalink
Merge pull request #169 from purcell/no-color-theme
Browse files Browse the repository at this point in the history
Remove support for the legacy color-theme library
  • Loading branch information
purcell committed Feb 20, 2024
2 parents 730d4b8 + 8fe0086 commit 7aa45c3
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 63 deletions.
25 changes: 12 additions & 13 deletions README.markdown
Expand Up @@ -8,30 +8,29 @@ An Emacs version of
with much more extensive face definitions than the "official" Emacs
variant.

The themes work with both the built-in theming support in recent
Emacsen, *and* via the traditional `color-theme.el` add-on library in
older versions, so use whichever you prefer.
These five color themes are designed for use with Emacs' built-in
theme support in Emacs 24, and provide a variety of contrast levels
with a broadly consistent colour assignment for each.

## Installation ##

If you're all set up to use [Marmalade](http://marmalade-repo.org) or
If you're all set up to use
[MELPA](http://melpa.org/) (highly recommended!), simply

M-x package-install RET color-theme-sanityinc-tomorrow RET

If you use [el-get](https://github.com/dimitri/el-get/), simply add
this to your packages list:
Otherwise, ensure a directory containing these files is on your `load-path`, then

color-theme-sanityinc-tomorrow

Otherwise, ensure a directory containing these files is on your `load-path`.

If you're using an Emacs version older than 23.x, you'll also need to
install `color-theme.el`.
(require 'color-theme-sanityinc-tomorrow)

## Usage ##

(require 'color-theme-sanityinc-tomorrow)
Use the `load-theme` command, to activate one of these themes
programatically, or use `customize-themes` to select a theme
interactively.

Aternatively, use one of the provided wrapper commands to activate a
theme:

M-x color-theme-sanityinc-tomorrow-day
M-x color-theme-sanityinc-tomorrow-night
Expand Down
70 changes: 25 additions & 45 deletions color-theme-sanityinc-tomorrow.el
Expand Up @@ -24,17 +24,17 @@
;;; Commentary:

;; These five color themes are designed for use with Emacs' built-in
;; theme support in Emacs 24. However, they also work with older Emacs
;; versions, in which case color-theme.el is required.
;; theme support in Emacs 24, and provide a variety of contrast levels
;; with a broadly consistent colour assignment for each.

;; Usage:

;; If your Emacs has the `load-theme' command, you can use it to
;; activate one of these themes programatically, or use
;; `customize-themes' to select a theme interactively.
;; Use the`load-theme' command, to activate one of these themes
;; programatically, or use `customize-themes' to select a theme
;; interactively.

;; Alternatively, or in older Emacs versions, use one of the provided
;; wrapper commands to activate a theme:
;; Alternatively, use one of the provided wrapper commands to activate
;; a theme:

;; M-x color-theme-sanityinc-tomorrow-day
;; M-x color-theme-sanityinc-tomorrow-night
Expand All @@ -52,7 +52,6 @@
(require 'color)

(eval-when-compile (require 'ansi-color))
(declare-function color-theme-install "color-theme")

(defun sanityinc-tomorrow--interpolate (hex1 hex2 gradations which)
(let ((c1 (color-name-to-rgb hex1))
Expand Down Expand Up @@ -541,6 +540,10 @@ names to which it refers are bound."
(message-header-newsgroups (:foreground ,aqua :background unspecified :slant normal))
(message-separator (:foreground ,purple))

;; Meow
(meow-beacon-fake-cursor (:foreground ,orange :inverse-video t))
(meow-search-highlight (:inherit lazy-highlight))

;; nim-mode
(nim-font-lock-export-face (:inherit font-lock-function-name-face))
(nim-font-lock-number-face (:inherit default))
Expand Down Expand Up @@ -1617,23 +1620,9 @@ names to which it refers are bound."
(ztreep-node-face (:foreground ,foreground))
))))

(defmacro color-theme-sanityinc-tomorrow--frame-parameter-specs ()
"Return a backquote which defines a list of frame parameter specs.
These are required by color-theme's `color-theme-install', but
not by the new `deftheme' mechanism. It expects to be evaluated
in a scope in which the various color names to which it refers
are bound."
(quote
`(((background-color . ,background)
(background-mode . light)
(border-color . ,foreground)
(cursor-color . ,red)
(foreground-color . ,foreground)
(mouse-color . ,aqua)))))

(defun color-theme-sanityinc-tomorrow--theme-name (mode)
(intern (format "sanityinc-tomorrow-%s" (symbol-name mode))))
(eval-and-compile
(defun color-theme-sanityinc-tomorrow--theme-name (mode)
(intern (format "sanityinc-tomorrow-%s" (symbol-name mode)))))

(defmacro color-theme-sanityinc-tomorrow--define-theme (mode)
"Define a theme for the tomorrow variant `MODE'."
Expand All @@ -1655,7 +1644,7 @@ are bound."
'((20 . ,red)
(40 . ,orange)
(60 . ,yellow)
(80 . ,green)
theme (80 . ,green)
(100 . ,aqua)
(120 . ,blue)
(140 . ,purple)
Expand All @@ -1678,25 +1667,16 @@ are bound."
))
(provide-theme ',name))))

(defun color-theme-sanityinc-tomorrow (mode)
"Apply the tomorrow variant theme."
(if (fboundp 'load-theme)
(let ((name (color-theme-sanityinc-tomorrow--theme-name mode)))
(if (boundp 'custom-enabled-themes)
(custom-set-variables `(custom-enabled-themes '(,name)))
(if (> emacs-major-version 23)
(load-theme name t)
(load-theme name))))
(progn
(require 'color-theme)
(color-theme-sanityinc-tomorrow--with-colors
mode
(color-theme-install
`(,(intern (concat "color-theme-sanityinc-tomorrow-" (symbol-name mode)))
,@(color-theme-sanityinc-tomorrow--frame-parameter-specs)
,@(color-theme-sanityinc-tomorrow--face-specs)))
;; ansi-color - comint and other modes that handle terminal color escape sequences
(setq ansi-color-names-vector (vector background red green yellow blue purple aqua foreground))))))
(defun color-theme-sanityinc-tomorrow (variant)
"Apply the given tomorrow theme VARIANT, e.g. `night'."
(let ((name (color-theme-sanityinc-tomorrow--theme-name variant)))
(custom-set-variables `(custom-enabled-themes '(,name)))))

(color-theme-sanityinc-tomorrow--define-theme night)
(color-theme-sanityinc-tomorrow--define-theme day)
(color-theme-sanityinc-tomorrow--define-theme eighties)
(color-theme-sanityinc-tomorrow--define-theme blue)
(color-theme-sanityinc-tomorrow--define-theme bright)

;;;###autoload
(when (boundp 'custom-theme-load-path)
Expand Down
1 change: 0 additions & 1 deletion sanityinc-tomorrow-blue-theme.el
@@ -1,3 +1,2 @@
;;; -*- lexical-binding: t -*-
(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow--define-theme blue)
1 change: 0 additions & 1 deletion sanityinc-tomorrow-bright-theme.el
@@ -1,3 +1,2 @@
;;; -*- lexical-binding: t -*-
(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow--define-theme bright)
1 change: 0 additions & 1 deletion sanityinc-tomorrow-day-theme.el
@@ -1,3 +1,2 @@
;;; -*- lexical-binding: t -*-
(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow--define-theme day)
1 change: 0 additions & 1 deletion sanityinc-tomorrow-eighties-theme.el
@@ -1,3 +1,2 @@
;;; -*- lexical-binding: t -*-
(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow--define-theme eighties)
1 change: 0 additions & 1 deletion sanityinc-tomorrow-night-theme.el
@@ -1,3 +1,2 @@
;;; -*- lexical-binding: t -*-
(require 'color-theme-sanityinc-tomorrow)
(color-theme-sanityinc-tomorrow--define-theme night)

0 comments on commit 7aa45c3

Please sign in to comment.