From 56097f53a2a8705ba86d06cf2f43d6c8b361d7be Mon Sep 17 00:00:00 2001 From: Joe Wreschnig Date: Sat, 10 Jun 2017 21:39:06 +0200 Subject: [PATCH] Greatly extend color palette and faces configured. --- BTCSB-theme.el | 296 +++++++++++++++++++++++++++++++++---------------- README.md | 15 +-- 2 files changed, 207 insertions(+), 104 deletions(-) diff --git a/BTCSB-theme.el b/BTCSB-theme.el index e7fa640..b0cd08e 100644 --- a/BTCSB-theme.el +++ b/BTCSB-theme.el @@ -1,106 +1,214 @@ -(deftheme BTCSB "Baby, The Code Shines Bright.") - -(let ((class '((class color) (min-colors 89))) - (btcsb-fg "#f6f6f6") - (btcsb-fg-1 "#9c69f6") - (btcsb-fg-2 "#fff39e") - (btcsb-fg-3 "#d99ed1") - (btcsb-fg-4 "#4d605f") - (btcsb-fg-5 "#bff294") - (btcsb-fg-6 "#de99bf") - (btcsb-fg-7 "#94579e") - (btcsb-fg-8 "#61c8c3") - (btcsb-fg-9 "#f465b6") - (btcsb-fg-10 "#9ca8d4") - - (btcsb-bg-1 "#a768ef") - (btcsb-bg-2 "#533477") - (btcsb-bg-3 "#d44741") - (btcsb-bg-4 "#2a1852") - (btcsb-bg-5 "#041c1a") +;;; BTCSB-theme.el --- Baby, the Code Shines Bright -*- lexical-binding: t; -*- +;; +;; Author: Joe Wreschnig +;; Package-Version: 20170610 +;; Package-Requires: ((emacs "24")) +;; Keywords: faces +;; +;; This is free and unencumbered software released into the public +;; domain. Anyone is free to copy, modify, publish, use, compile, +;; sell, or distribute this software, either in source code form or as +;; a compiled binary, for any purpose, commercial or non-commercial, +;; and by any means. + +;;; Commentary: +;; +;; "Baby, The Code Shines Bright" is an Emacs adaptation of Jessica +;; Allen's TextMate theme of the same name, which is in turn a +;; TextMate adaptation of frilly dresses. +;; +;; Because Emacs is not TextMate, it doesn't look exactly the same, +;; but it uses the same color palette and basic color choices. + +;;; Code: + +(require 'color) + +(deftheme BTCSB "Baby, The Code Shines Bright theme + +Baby, The Code Shines Bright is an Emacs adaptation of Jessica +Allen's TextMate theme of the same name, a pastel-on-dark color +palette inspired by lolita dresses. URL +`http://spacekat.github.com/blog/2010/08/26/cute-code-overload/' + +That's in turn a TextMate adaptation of frilly dresses. URL +`http://www.babyssb.co.jp/' + +The theme doesn't provide a default font family or size, but +recommended pairings are Fantasque Sans or Monaco.") + +(defun BTCSB-theme-dim (color dark desaturate) + "Darken COLOR by DARK and desaturate it by DESATURATE." + (color-desaturate-name (color-darken-name color dark) desaturate)) + +(let (;; These are the colors from the original TextMate theme, along + ;; with what they were used for. These do not map cleanly either + ;; way to Emacs faces (I'm not sure what a "CSS constructor + ;; argument" even is) so the comments are more for reference + ;; back to the original file than any current use. + ;; + ;; "Support" refers to built-ins along with interfaces which are + ;; part of standard libraries; Emacs modes generally do not + ;; distinguish between library and client code. + ;; + ;; Most colors that were used as background colors are instead + ;; used as accents (e.g. underline and fringe), because Emacs + ;; doesn't blend colors when given multiple faces. Background + ;; colors are reserved for short-lived states that need + ;; immediate attention, e.g. region and search selection. + + ;; TODO: Several of these colors are too dark to be reasonable, + ;; even if I assume they were in Generic RGB γ=2.2 originally. + ;; Also a few are indistinguishable to me on the displays + ;; I've tested so far (e.g. the two bright yellows). We could + ;; either merge them or pick a few more shades from more recent + ;; Baby design palettes. + + (clr01 "#000000") ; background + (clr02 "#041C1A") ; line highlight + (clr03 "#1C1C1C") ; CSS constructor background + + (clr04 "#F6F6F6") ; default foreground + (clr05 "#3E3E3E") ; precomposed "invisibles" foreground + (clr06 "#FFFFFF") ; caret + + (clr07 "#4D605F") ; comment + (clr08 "#8693A5") ; CSS @at-rule + (clr09 "#9CA8D4") ; deprecated foreground + + (clr10 "#D99ED1") ; entity + (clr11 "#DE99BF") ; support function, CSS property value + (clr12 "#F465B6") ; variable, string variable, CSS additional constant + + (clr13 "#94579E") ; keyword + (clr14 "#9C69F6") ; regexp special + (clr15 "#A768EF") ; selection overlay + (clr16 "#442A61") ; premultiplied selection overlay, 41% opacity + + (clr17 "#B3F382") ; string constant, support constant, CSS pseudo-class + (clr18 "#BFF294") ; constant + + (clr19 "#FFC53B") ; old selection highlight at 48% opacity + (clr20 "#F9EE99") ; regexp + (clr21 "#FFF39E") ; storage (i.e. type) + + (clr22 "#2A1852") ; deprecated background + (clr23 "#4B7FD4") ; support, inheritance, CSS constructor argument + (clr24 "#5BB5D0") ; CSS class name + (clr25 "#61C8C3") ; strings, embedded source + (clr26 "#9CEFF2") ; CSS tag name, ID + (clr27 "#D44741") ; illegal background + + ;; Additional colors from a variant by Zak Remer + (clr28 "#240C29") ; alternate line highlight + (clr29 "#100E2D") ; alternate highlight + (clr30 "#DB558F") ; alternate storage modifier ) (custom-theme-set-faces 'BTCSB - `(default ((t (:background "black" - :foreground ,btcsb-fg - :slant normal - :weight normal - :height 120 - :width normal - :foundry "apple" - :family "Monaco")))) - `(cursor ((t (:background "#FFFFFF")))) - `(fixed-pitch ((t (:family "Monospace")))) - `(variable-pitch ((t (:family "Sans Serif")))) - `(escape-glyph ((t (:foreground ,btcsb-fg-2)))) - `(minibuffer-prompt ((t (:foreground ,btcsb-fg-1)))) - `(highlight ((t (:background ,btcsb-bg-1)))) - `(region ((t (:background ,btcsb-bg-2)))) - `(shadow ((t (:foreground "#777777")))) - `(secondary-selection ((t (:background ,btcsb-bg-2)))) - `(trailing-whitespace ((t (:background ,btcsb-bg-3)))) - `(font-lock-builtin-face ((t (:foreground ,btcsb-fg-3)))) - `(font-lock-comment-delimiter-face ((t (:inherit (font-lock-comment-face))))) - `(font-lock-comment-face ((t (:foreground ,btcsb-fg-4 :slant italic)))) - `(font-lock-constant-face ((t (:foreground ,btcsb-fg-5)))) - `(font-lock-doc-face ((t (:inherit font-lock-string-face)))) - `(font-lock-function-name-face ((t (:foreground ,btcsb-fg-6)))) - `(font-lock-keyword-face ((t (:foreground ,btcsb-fg-7)))) - `(font-lock-negation-char-face ((t nil))) - `(font-lock-preprocessor-face ((t (:inherit (font-lock-builtin-face))))) - `(font-lock-regexp-grouping-backslash ((t (:inherit (bold))))) - `(font-lock-regexp-grouping-construct ((t (:inherit (bold))))) - `(font-lock-string-face ((t (:foreground ,btcsb-fg-8)))) - `(font-lock-type-face ((t (:foreground ,btcsb-fg-3)))) - `(font-lock-variable-name-face ((t (:foreground ,btcsb-fg-9)))) - `(font-lock-warning-face ((t (:background ,btcsb-bg-4 - :foreground ,btcsb-fg-10 - :underline t)))) + + ;; Basic Faces `(button ((t (:inherit (link))))) - `(link ((t (:foreground ,btcsb-fg-2 :underline t)))) - `(link-visited ((t (:inherit link :foreground ,btcsb-fg-6)))) - `(fringe ((t (:background ,btcsb-bg-5)))) - `(header-line ((t (:inherit mode-line - :background ,btcsb-bg-5 - :foreground ,btcsb-fg - :box nil)))) - `(tooltip ((t (:inherit variable-pitch - :background ,btcsb-fg-2 - :foreground "black")))) - `(mode-line ((t (:background ,btcsb-fg-1 - :foreground "black" - :box (:line-width -1 :style released-button))))) - `(mode-line-buffer-id ((t (:weight bold)))) + `(cursor ((t (:background ,clr06)))) + `(default ((t (:background ,clr01 :foreground ,clr04)))) + `(error ((t (:foreground ,clr27)))) + `(escape-glyph ((t (:foreground ,clr18)))) + `(fringe ((t (:background ,clr03)))) + ;; `(header TODO: I don't use this....) + `(highlight ((t (:background ,clr16)))) + `(isearch ((t (:background ,clr15)))) + `(lazy-highlight ((t (:background ,clr09)))) + `(link ((t (:foreground ,clr26 :underline t)))) + `(link-visited ((t (:inherit link :foreground ,clr25)))) + `(match ((t (:inherit (lazy-highlight))))) + `(menu ((t (:background ,clr29)))) + `(minibuffer-prompt ((t (:foreground ,clr17)))) + `(mode-line ((t (:background ,clr14 :foreground ,clr02)))) + `(mode-line-buffer-id ((t (:weight bold :foreground ,clr01)))) `(mode-line-emphasis ((t (:weight bold)))) - `(mode-line-highlight ((t (:background ,btcsb-bg-2 - :box (:line-width 2 - :color ,btcsb-bg-2 - :style released-button))))) - `(mode-line-inactive ((t (:weight light - :box (:line-width -1 :color ,btcsb-bg-2) - :foreground ,btcsb-fg - :background ,btcsb-bg-2 + `(mode-line-highlight ((t (:foreground ,clr21)))) + `(mode-line-inactive ((t (:background ,(BTCSB-theme-dim clr14 25 55) :inherit mode-line)))) - `(isearch ((t (:background ,btcsb-bg-1)))) - `(isearch-fail ((t (:background ,btcsb-bg-3 :foreground ,btcsb-fg)))) - `(lazy-highlight ((t (:background ,btcsb-bg-2)))) - `(match ((t (:background ,btcsb-fg-1)))) - `(next-error ((t (:inherit (region))))) + `(nobreak-space ((t (:foreground ,clr05 :underline t)))) + `(region ((t (:background ,clr16)))) + `(secondary-selection ((t (:inherit (region))))) + `(shadow ((t (:foreground ,clr08)))) + `(success ((t (:foreground ,clr17)))) + `(trailing-whitespace ((t (:background ,clr22)))) + `(tty-menu-enabled-face ((t (:foreground ,clr04 :background ,clr16)))) + `(tty-menu-selected-face ((t (:foreground ,clr04 :background ,clr15)))) + `(tty-menu-disabled-face ((t (:foreground ,clr08 :background ,clr16)))) + `(warning ((t (:foreground ,clr19)))) + + ;; Font Lock Faces + `(font-lock-builtin-face ((t (:foreground ,clr23)))) + `(font-lock-comment-delimiter-face ((t (:inherit (font-lock-comment-face))))) + `(font-lock-comment-face ((t (:foreground ,clr07)))) + `(font-lock-constant-face ((t (:foreground ,clr18)))) + `(font-lock-doc-face ((t (:foreground ,clr24)))) + `(font-lock-function-name-face ((t (:foreground ,clr11)))) + `(font-lock-keyword-face ((t (:foreground ,clr13)))) + `(font-lock-negation-char-face ((t nil))) + `(font-lock-preprocessor-face ((t (:inherit (font-lock-builtin-face))))) + `(font-lock-regexp-grouping-backslash ((t :foreground ,clr08))) + `(font-lock-regexp-grouping-construct ((t :foreground ,clr08))) + `(font-lock-string-face ((t (:foreground ,clr25)))) + `(font-lock-type-face ((t (:foreground ,clr21)))) + `(font-lock-variable-name-face ((t (:foreground ,clr12)))) + `(font-lock-warning-face ((t (:foreground ,clr20)))) + + ;; Highlighted Line Face + `(hl-line ((t (:background ,clr28)))) + + ;; Matching / I-search Faces + `(isearch-fail ((t (:foreground ,clr09)))) `(query-replace ((t (:inherit (isearch))))) - - `(flyspell-duplicate ((t (:foreground ,btcsb-fg-9 - :weight bold - :underline t)))) - `(flyspell-incorrect ((t (:foreground ,btcsb-fg-9 - :weight bold - :underline t)))) + + ;; Flyspell Mode Faces + `(flyspell-incorrect ((t (:underline (:color ,clr27 :style wave))))) + ;; Repeating a mistake doesn't make it right. + `(flyspell-duplicate ((t (:inherit (flyspell-incorrect))))) + + ;; Flycheck Faces + `(flycheck-error ((t (:underline (:color ,clr27 :style wave))))) + `(flycheck-error-list-error ((t (:foreground ,clr27)))) + `(flycheck-fringe-error ((t (:foreground ,clr27)))) + `(flycheck-warning ((t (:underline (:color ,clr19 :style wave))))) + `(flycheck-error-list-warning ((t (:foreground ,clr20)))) + `(flycheck-fringe-warning ((t (:foreground ,clr20)))) + `(flycheck-info ((t (:underline (:color ,clr24 :style wave))))) + `(flycheck-error-list-info ((t (:foreground ,clr24)))) + `(flycheck-fringe-info ((t (:foreground ,clr24)))) + `(flycheck-error-list-id ((t (:inherit (font-lock-constant-face))))) + `(flycheck-error-list-checker-name ((t (:foreground ,clr11)))) + + ;; Pp^l Highlight Face - it's like a comment, I guess? I'm never + ;; happy with how this looks except that I'm always happier to see + ;; it than a literal ^L. + `(pp^L-highlight ((t (:box (:color ,clr07))))) + + ;; Spar^L Mode Face. It's called "shines bright" after all. + `(spar^l-mode ((t (:foreground ,clr30)))) + + ;; Magit Faces + `(magit-section-highlight ((t (:inherit (region))))) + + ;; Web Mode Faces + `(web-mode-html-tag-face ((t (:foreground ,clr11)))) + `(web-mode-html-attr-name-face ((t (:foreground ,clr11)))) + `(web-mode-html-entity-face ((t (:foreground ,clr10)))) + `(web-mode-html-attr-equal-face ((t (:inherit (shadow))))) + `(web-mode-css-selector-face ((t (:foreground ,clr26)))) + `(web-mode-css-pseudo-class-face ((t (:foreground ,clr17)))) )) -(and load-file-name - (boundp 'custom-theme-load-path) - (add-to-list 'custom-theme-load-path - (file-name-as-directory - (file-name-directory load-file-name)))) +;;;###autoload +(when load-file-name + (add-to-list 'custom-theme-load-path + (file-name-directory load-file-name))) (provide-theme 'BTCSB) +(provide 'BTCSB-theme) + +;;; BTCSB-theme.el ends here diff --git a/README.md b/README.md index 97a25c1..1d74185 100644 --- a/README.md +++ b/README.md @@ -2,21 +2,16 @@ _Baby, The Code Shines Bright_ is an Emacs adaptation of [Jessica Allen's TextMate theme of the same name][1], which is in turn a TextMate adaptation of [frilly dresses][3]. -Because Emacs and TextMate have slightly different views on how to -fontify source code, it doesn't look exactly the same, but I think it -has the same spirit. +Because Emacs is not TextMate, it doesn't look exactly the same, but +it uses the same color palette and basic color choices. -It uses the new Emacs 24 theming capabilities, and not the old -`color-theme` interface. To use it, just dump it in your `~/.emacs.d` -and add something like +To use it, just dump it in your `~/.emacs.d` and add something like (load-theme 'BTCSB t) -to your `~/.emacs`. Make sure to disable any `color-theme`-based -theming you may have been using previously because if put in the same -buffer they will fight in uncute ways. +to your `~/.emacs`. -For more help with the new Emacs theming method, +For more help with the “new” Emacs theming method in Emacs 24, [Bozhidar Batsov has a quick overview of the new interface][2]. [1]: http://spacekat.github.com/blog/2010/08/26/cute-code-overload/ -- 2.30.2