Skip to content

Instantly share code, notes, and snippets.

@jimeh
Forked from purcell/emacs-osx-srgb.patch
Last active December 25, 2015 01:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimeh/6898606 to your computer and use it in GitHub Desktop.
Save jimeh/6898606 to your computer and use it in GitHub Desktop.
Adjusted for Emacs 24.3 source specifically
diff --git a/src/nsterm.m b/src/nsterm.m
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1401,7 +1401,7 @@ ns_get_color (const char *name, NSColor
if (r >= 0.0)
{
- *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
+ *col = [NSColor colorWithSRGBRed: r green: g blue: b alpha: 1.0];
UNBLOCK_INPUT;
return 0;
}
@@ -1433,7 +1433,7 @@ ns_get_color (const char *name, NSColor
}
if (new)
- *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
+ *col = [new colorUsingColorSpace: [NSColorSpace sRGBColorSpace]];
UNBLOCK_INPUT;
return new ? 0 : 1;
}
@@ -1489,7 +1489,7 @@ ns_color_to_lisp (NSColor *col)
return build_string ((char *)str);
}
- [[col colorUsingColorSpaceName: NSCalibratedRGBColorSpace]
+ [[col colorUsingColorSpace: [NSColorSpace sRGBColorSpace]]
getRed: &red green: &green blue: &blue alpha: &alpha];
if (red ==green && red ==blue)
{
@@ -1575,7 +1575,7 @@ ns_get_rgb_color (struct frame *f, float
if (a < 0.0) a = 0.0;
else if (a > 1.0) a = 1.0;
return (unsigned long) ns_index_color(
- [NSColor colorWithCalibratedRed: r green: g blue: b alpha: a], f);
+ [NSColor colorWithSRGBRed: r green: g blue: b alpha: a], f);
}
@@ -3806,7 +3806,7 @@ ns_term_init (Lisp_Object display_name)
name = SDATA (XCAR (color));
c = XINT (XCDR (color));
[cl setColor:
- [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
+ [NSColor colorWithSRGBRed: RED_FROM_ULONG (c) / 255.0
green: GREEN_FROM_ULONG (c) / 255.0
blue: BLUE_FROM_ULONG (c) / 255.0
alpha: 1.0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment