Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add a customization to control whether the compensated color values w…

…ill be used
  • Loading branch information...
commit 1e646551303743d5e22fd5e0fdbcc019849be6c5 1 parent fdd1540
Steve Purcell authored

Showing 2 changed files with 33 additions and 17 deletions. Show diff stats Hide diff stats

  1. +5 1 README.markdown
  2. +28 16 color-theme-sanityinc-solarized.el
6 README.markdown
Source Rendered
@@ -60,4 +60,8 @@ instead.
60 60
61 61 Note that, depending on your version of Emacs, the colors in this
62 62 theme may not be rendered accurately. See, for example,
63   -[this OS X Emacs bug](http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402).
  63 +[this OS X Emacs bug](http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402). A
  64 +customizable value `color-theme-sanityinc-solarized-rgb-is-srgb`
  65 +controls whether or not RGB color literals used by Emacs are treated
  66 +as sRGB; consider adjusting this value if the rendered colors don't
  67 +quite match those on the solarized page.
44 color-theme-sanityinc-solarized.el
@@ -47,27 +47,39 @@
47 47
48 48 (require 'cl)
49 49
  50 +(defgroup color-theme-sanityinc-solarized nil
  51 + "The sanityinc solarized theme pair."
  52 + :group 'appearance
  53 + :prefix "color-theme-sanityinc-solarized-")
  54 +
  55 +(defcustom color-theme-sanityinc-solarized-rgb-is-srgb
  56 + (not (eq window-system 'ns))
  57 + "Indicates whether RGB triplets are treated as sRGB by the host Emacs.
  58 +Set this to t if using the sRGB patch on OS X."
  59 + :group 'color-theme-sanityinc-solarized)
  60 +
50 61 (defmacro color-theme-sanityinc-solarized--with-colors (mode &rest body)
51 62 "Execute `BODY' in a scope with variables bound to the various solarized colors.
52 63
53 64 `MODE' should be set to either 'light or 'dark."
54 65 ;; These are the Generic RGB equivalents of the "official" sRGB hex values
55   - `(let* ((base03 "#042028") ; (0.0159 0.1265 0.1597)
56   - (base02 "#0a2832") ; (0.0394 0.1601 0.1983)
57   - (base01 "#465a61") ; (0.2767 0.3567 0.3830)
58   - (base00 "#52676f") ; (0.3244 0.4072 0.4385)
59   - (base0 "#708183") ; (0.4406 0.5096 0.5169)
60   - (base1 "#81908f") ; (0.5060 0.5649 0.5636)
61   - (base2 "#e9e2cb") ; (0.9161 0.8900 0.7978)
62   - (base3 "#fcf4dc") ; (0.9894 0.9579 0.8641)
63   - (yellow "#a57705") ; (0.6475 0.4675 0.0235)
64   - (orange "#bd3612") ; (0.7418 0.2133 0.0735)
65   - (red "#c60007") ; (0.7770 0.0000 0.0290)
66   - (magenta "#c61b6e") ; (0.7774 0.1080 0.4352)
67   - (violet "#5859b7") ; (0.3479 0.3514 0.7179)
68   - (blue "#2075c7") ; (0.1275 0.4627 0.7823)
69   - (cyan "#259185") ; (0.1468 0.5708 0.5250)
70   - (green "#728a05") ; (0.4498 0.5412 0.0202)
  66 + `(let* ((srgb color-theme-sanityinc-solarized-rgb-is-srgb)
  67 + (base03 (if srgb "#002b36" "#042028")) ; (0.0159 0.1265 0.1597)
  68 + (base02 (if srgb "#073642" "#0a2832")) ; (0.0394 0.1601 0.1983)
  69 + (base01 (if srgb "#586e75" "#465a61")) ; (0.2767 0.3567 0.3830)
  70 + (base00 (if srgb "#657b83" "#52676f")) ; (0.3244 0.4072 0.4385)
  71 + (base0 (if srgb "#839496" "#708183")) ; (0.4406 0.5096 0.5169)
  72 + (base1 (if srgb "#93a1a1" "#81908f")) ; (0.5060 0.5649 0.5636)
  73 + (base2 (if srgb "#eee8d5" "#e9e2cb")) ; (0.9161 0.8900 0.7978)
  74 + (base3 (if srgb "#fdf6e3" "#fcf4dc")) ; (0.9894 0.9579 0.8641)
  75 + (yellow (if srgb "#b58900" "#a57705")) ; (0.6475 0.4675 0.0235)
  76 + (orange (if srgb "#cb4b16" "#bd3612")) ; (0.7418 0.2133 0.0735)
  77 + (red (if srgb "#dc322f" "#c60007")) ; (0.7770 0.0000 0.0290)
  78 + (magenta (if srgb "#d33682" "#c61b6e")) ; (0.7774 0.1080 0.4352)
  79 + (violet (if srgb "#6c71c4" "#5859b7")) ; (0.3479 0.3514 0.7179)
  80 + (blue (if srgb "#268bd2" "#2075c7")) ; (0.1275 0.4627 0.7823)
  81 + (cyan (if srgb "#2aa198" "#259185")) ; (0.1468 0.5708 0.5250)
  82 + (green (if srgb "#859900" "#728a05")) ; (0.4498 0.5412 0.0202)
71 83 (foregrounds (list base1 base0 base00 base01))
72 84 (backgrounds (list base03 base02))
73 85 (contrast-backgrounds (list base3 base2)))

0 comments on commit 1e64655

Please sign in to comment.
Something went wrong with that request. Please try again.