From 0127faafbe9c3e2da5ec711421c4fac1c82c3242 Mon Sep 17 00:00:00 2001 From: Greg Pfeil Date: Sun, 12 Feb 2012 09:26:13 -0700 Subject: [PATCH] Add `solarized-broken-srgb` custom variable. This allows real sRGB colors where it's supported and Gen RGB where it's not. Fixes issue #19. Adapted from a patch by @hdhoang. --- README.md | 29 +++++++++++++++++++---------- solarized-definitions.el | 10 +++++++++- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 00932cb..23d1b04 100644 --- a/README.md +++ b/README.md @@ -74,16 +74,17 @@ Advanced Configuration 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 - solarized-italic = t | nil - solarized-contrast = normal| high, low - solarized-visibility= normal| high, low - ------------------------------------------- + variable name default optional + -------------------------------------------- + solarized-termcolors = 16 | 256 + solarized-degrade = nil | t + solarized-bold = t | nil + solarized-underline = t | nil + solarized-italic = t | nil + solarized-contrast = normal| high, low + solarized-visibility = normal| high, low + solarized-broken-srgb= nil | t (see details for Mac behavior) + -------------------------------------------- ### Option Details @@ -121,6 +122,14 @@ but does include several variables that can be customized. Special characters such as trailing whitespace, tabs, newlines, when displayed using `:set list` can be set to one of three levels depending on your needs. Default value is `normal` with `high` and `low` options. + +* solarized-broken-srgb + + Emacs [bug #8402](http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8402) + results in incorrect color handling on Macs. If this is `t` (the default + on Macs), Solarized works around it with alternative colors. However, + these colors are not totally portable, so you may be able to edit the + "Gen RGB" column in `solarized-definitions.el` to improve them further. Code Notes ---------- diff --git a/solarized-definitions.el b/solarized-definitions.el index b48f34e..fd98592 100644 --- a/solarized-definitions.el +++ b/solarized-definitions.el @@ -44,6 +44,14 @@ in order to expand or compress the tonal range displayed." :options '(high normal low) :group 'solarized) +(defcustom solarized-broken-srgb (if (eq system-type 'darwin) t nil) + "Emacs bug #8402 results in incorrect color handling on Macs. If this is t +(the default on Macs), Solarized works around it with alternative colors. +However, these colors are not totally portable, so you may be able to edit the +\"Gen RGB\" column in solarized-definitions.el to improve them further." + :type 'boolean + :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 @@ -74,7 +82,7 @@ in order to expand or compress the tonal range displayed." (let ((index (if window-system (if solarized-degrade 3 - 2) + (if solarized-broken-srgb 2 1)) (if (= solarized-termcolors 256) 3 4))))