diff --git a/README.md b/README.md index 85b0af3..35415de 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Installation & Usage 1. Add the `emacs-color-theme-solarized` directory to your Emacs `load-path`. 2. `M-x enable-theme`, then either `solarized-light` or `solarized-dark`. -### [color-theme] (pre-Emacs 24) +### [color-theme] \(pre-Emacs 24\) 1. Download and install [color-theme]. 2. Add the `emacs-color-theme-solarized` directory to your Emacs `load-path`. @@ -45,14 +45,23 @@ Installation & Usage ### IMPORTANT NOTE FOR TERMINAL USERS: -If you are going to use Solarized in Terminal mode (i.e. not in a GUI version -like Cocoa or X11 Emacs), **please please please** consider setting your terminal emulator's colorscheme to used the Solarized palette. I've included palettes for some popular terminal emulator as well as Xdefaults in the official Solarized download available from [Solarized homepage]. If you use -Solarized *without* these colors, Solarized will need to be told to degrade its colorscheme to a set compatible with the limited 256 terminal palette (whereas by using the terminal's 16 ansi color values, you can set the correct, specific values for the Solarized palette). +If you are going to use Solarized in Terminal mode (i.e. not in a GUI version +like Cocoa or X11 Emacs), **please please please** consider setting your +terminal emulator's colorscheme to use the Solarized palette. The [Solarized +repository] includes palettes for some popular terminal emulator as well as +Xdefaults; or you can download them from the official [Solarized homepage]. +If you use this emacs color theme *without* having changed your emulator's +palette, you will need to configure Solarized to degrade its colorscheme to +a set compatible with the terminal's default limited 256 color palette +(whereas by using the terminal's 16 ANSI color values, you would +see the correct, specific values for the Solarized palette). -If you do use the custom terminal colors, Solarized should work out of the -box for you. If you are using a terminal emulator that supports 256 colors and -don't want to use the custom Solarized terminal colors, you will need to use -the degraded 256 colorscheme. To do so, simply customize the `solarized-degrade` variable to `t`. +If you do use the custom terminal colors, i.e. the 16 overridden ANSI color +values, the emacs colorscheme should work out of the box for you. If you are +using a terminal emulator that supports 256 colors and don't want to use +the custom Solarized terminal colors, you will need to use the degraded 256 +colorscheme. To do so, simply customize the `solarized-termcolor` variable to +`256`. Again, I recommend just changing your terminal colors to Solarized values either manually or via one of the many terminal schemes available for import. @@ -60,10 +69,12 @@ either manually or via one of the many terminal schemes available for import. Advanced Configuration ---------------------- -Solarized will work out of the box with just the instructions specified above but does include several other variables that can be customized. +Solarized will work out of the box with just the instructions specified above +but does include several variables that can be customized. variable name default optional ------------------------------------------- + solarized-termcolors= 16 | 256 solarized-degrade = nil | t solarized-bold = t | nil solarized-underline = t | nil @@ -74,10 +85,23 @@ Solarized will work out of the box with just the instructions specified above bu ### Option Details +* solarized-termcolors + + This is set to *16* by default, meaning that Solarized will attempt to use + the standard 16 colors of your terminal emulator, assuming that you've set + these colors to the correct Solarized values either manually or by + importing one of the many colorscheme available for popular terminal + emulators and Xdefaults. + If you don't want to use the Solarized colors via the terminal + emulator's palette, you can set this to *256*, which will use a degraded + version of the Solarized palette by displaying the closest colors in + the terminal's default 256 colors as shown in [Xterm's color + chart](http://en.wikipedia.org/wiki/File:Xterm_color_chart.png). + * solarized-degrade - For test purposes only; forces Solarized to use the 256 degraded color - mode to test the approximate color values for accuracy. + For test purposes only; in GUI mode, this forces Solarized to use the 256 + degraded color mode to test the approximate color values for accuracy. * solarized-bold | solarized-underline | solarized-italic diff --git a/color-theme-solarized.el b/color-theme-solarized.el old mode 100755 new mode 100644 diff --git a/solarized-definitions.el b/solarized-definitions.el index 469f264..c442857 100644 --- a/solarized-definitions.el +++ b/solarized-definitions.el @@ -3,7 +3,7 @@ Ported to Emacs by Greg Pfeil, http://ethanschoonover.com/solarized.") (defcustom solarized-degrade nil - "For test purposes only; forces Solarized to use the 256 degraded color mode + "For test purposes only; when in GUI mode, forces Solarized to use the 256 degraded color mode to test the approximate color values for accuracy." :type 'boolean :group 'solarized) @@ -23,37 +23,49 @@ to test the approximate color values for accuracy." :type 'boolean :group 'solarized) +(defcustom solarized-termcolors 16 + "This setting applies to emacs in terminal (non-GUI) mode. +If set to 16, emacs will use the terminal emulator's colorscheme +(best option as long as you've set your emulator's colors to the Solarized palette). +If set to 256 and your terminal is capable of displaying 256 colors, emacs +will use the 256 degraded color mode." + :type 'integer + :group 'solarized) + ;; FIXME: The Generic RGB colors will actually vary from device to device, but ;; hopefully these are closer to the intended colors than the sRGB values ;; that Emacs seems to dislike (defvar solarized-colors - ;; name sRGB Gen RGB degraded - '((base03 "#002b36" "#042028" "#1c1c1c") - (base02 "#073642" "#0a2832" "#262626") - (base01 "#586e75" "#465a61" "#4e4e4e") - (base00 "#657b83" "#52676f" "#585858") - (base0 "#839496" "#708183" "#808080") - (base1 "#93a1a1" "#81908f" "#8a8a8a") - (base2 "#eee8d5" "#e9e2cb" "#d7d7af") - (base3 "#fdf6e3" "#fcf4dc" "#ffffd7") - (yellow "#b58900" "#a57705" "#af8700") - (orange "#cb4b16" "#bd3612" "#d75f00") - (red "#dc322f" "#c60007" "#af0000") - (magenta "#d33682" "#c61b6e" "#af005f") - (violet "#6c71c4" "#5859b7" "#5f5faf") - (blue "#268bd2" "#2075c7" "#0087ff") - (cyan "#2aa198" "#259185" "#00afaf") - (green "#859900" "#728a05" "#5f8700")) + ;; name sRGB Gen RGB degraded ANSI(Solarized terminal) + '((base03 "#002b36" "#042028" "#1c1c1c" "#7f7f7f") + (base02 "#073642" "#0a2832" "#262626" "#000000") + (base01 "#586e75" "#465a61" "#4e4e4e" "#00ff00") + (base00 "#657b83" "#52676f" "#585858" "#ffff00") + (base0 "#839496" "#708183" "#808080" "#5c5cff") + (base1 "#93a1a1" "#81908f" "#8a8a8a" "#00ffff") + (base2 "#eee8d5" "#e9e2cb" "#d7d7af" "#e5e5e5") + (base3 "#fdf6e3" "#fcf4dc" "#ffffd7" "#ffffff") + (yellow "#b58900" "#a57705" "#af8700" "#cdcd00") + (orange "#cb4b16" "#bd3612" "#d75f00" "#ff0000") + (red "#dc322f" "#c60007" "#af0000" "#cd0000") + (magenta "#d33682" "#c61b6e" "#af005f" "#cd00cd") + (violet "#6c71c4" "#5859b7" "#5f5faf" "#ff00ff") + (blue "#268bd2" "#2075c7" "#0087ff" "#0000ee") + (cyan "#2aa198" "#259185" "#00afaf" "#00cdcd") + (green "#859900" "#728a05" "#5f8700" "#00cd00")) "This is a table of all the colors used by the Solarized color theme. Each column is a different set, one of which will be chosen based on term capabilities, etc.") (defun solarized-color-definitions (mode) (flet ((find-color (name) - (let ((index (if (or (<= (display-color-cells) 256) - solarized-degrade) - 3 - 2))) + (let ((index (if window-system + (if solarized-degrade + 3 + 2) + (if (= solarized-termcolors 256) + 3 + 4)))) (nth index (assoc name solarized-colors))))) (let ((base03 (find-color 'base03)) (base02 (find-color 'base02))