lswank / Tranquility

Night vision for programmers. Work well in the dark. For OSX 10.9.
Apache License 2.0
162 stars 18 forks source link

Invert hue option.. Can it be brought back? #9

Open jccr opened 10 years ago

jccr commented 10 years ago

Nocturne used to have this feature that not only inverted the screen, but it also let you invert the color hues. For those that didn't know about this: Blue colors became orange colors when the screen was inverted, but with the invert hue option everything stayed dark but orange became blue again for example.

Can this feature be implemented again for 10.9?

Bountysource

amitmarkel commented 10 years ago

Please bring this option back - Hue inversion was the reason I'd used this application extensively.

ylluminate commented 10 years ago

A big +1 here as well. That is exceptionally necessary for this app as I prefer to see colors as they originally were -- or as close to them as possible vs what we presently have.

ejwessel commented 10 years ago

I hope I'm not hijacking this thread to a different area, but I as well have been in pursuit to bring back the invert hue option. There was some talk of this on the blacktree-nocturne forum here There was some speculation that "hue inversion was relying on a private API that may have changed."

If anybody has any ideas please share!

amitmarkel commented 10 years ago

Yes, I think I'd seen that. That feature was very important to me, so now I don't have real use for this program (yet). I wonder why Apple did not incorporate a similar option.

On Oct 22, 2014, at 5:43, ejwessel notifications@github.com wrote:

I hope I'm not hijacking this thread to a different area, but I as well have been in pursuit to bring back the invert hue option. There was some talk of this on the blacktree-nocturne forum here https://code.google.com/p/blacktree-nocturne/issues/detail?id=63 There was some speculation that "hue inversion was relying on a private API that may have changed."

If anybody has any ideas please share!

— Reply to this email directly or view it on GitHub https://github.com/lswank/Tranquility/issues/9#issuecomment-60029152.

jccr commented 10 years ago

I've done some research and I believe we might be able to achieve a similar effect with a highly customized ICC display profile. One that inverts the white point and black point and messes with the gamma levels. I have no idea as to how to actually create this profile, and have not found any "ICC profile editing" tool that specialized yet.

amitmarkel commented 10 years ago

Interesting, never thought about that direction. I think I encountered such an editor on the internet a few years ago; so it might be worth a search.

amitmarkel commented 10 years ago

Perhaps one can attempt to edit their default/retina display profile at /Library/ColorSync/Profiles/Displays with the builtin property editor.

ylluminate commented 10 years ago

:+1: Very good suggestion. It would be an enormous asset for this to have such a feature.

jbenet commented 10 years ago

+:100: Hue inversion is the main only real reason to use Nocturne Tranquility. I will pay for this feature.

jbenet commented 10 years ago

I just set a $50 on bountysource, because i want my greens to stay $@%&ing green. https://www.bountysource.com/issues/3167101-invert-hue-option-can-it-be-brought-back I recommend others who care about this issue to back it too. Whoever fixes this will deserve it, and it may get it to us sooner at all. (cc @kzsh - if you fix it on the original repo, i'll pay it there)

Hurry, Obi Wan Kenobi. You're my only hope. My computer now feels horribly unfamiliar and hostile.

kzsh commented 10 years ago

I spent some time looking into this for Nocturne. I agree with @JCCR that one solution would be a custom ICC profile, though, like him, I don't know how to do that. It's also possible that there's a filter we could use.

jbenet commented 10 years ago

@JCCR @kzsh can we figure something out together? Do we know anyone who knows ICC profiles?

jbenet commented 10 years ago

http://apple.stackexchange.com/questions/8374/white-on-black-without-inverting-colors?rq=1

ylluminate commented 10 years ago

That is a very interesting find there @jbenet. Any luck playing around with these two options?

jbenet commented 10 years ago

@ylluminate not yet :( -- i dont have the bandwdith to sink into and figure out how to edit / make ICC profiles.

amitmarkel commented 10 years ago

A filter which does inversion and hue inversion is easy to do, but it cannot be applied to a color profile I think.

ejwessel commented 10 years ago

I've been watching videos and reading a bit about how ICC profiles work and can be edited. I do have to say they aren't trivial(like the link above this mentions). Given that I'm no color expert and I'm assuming nobody else here is, I was entertaining the idea of purchasing, or better yet using, an ICC profile generator. Though that wouldn't solve the problem of how to get what we want it might be a step closer. Thats all I have for now. I'm going to go back to reading.

http://www.color.org/opensource.xalter

jbenet commented 10 years ago

@ejwessel have you found a good ICC generator?

We should find someone who knows ICC profiles well. Anyone have any leads?

ejwessel commented 10 years ago

I haven't tried any of the open source ones yet. No leads yet either =/ I do plan to start messing around with them this weekend, but we'll see what my schedule allows for =P

amitmarkel commented 10 years ago

I have managed to edit the standard Color LCD profile's tristimulus values with a hex editor. I think we need to understand how to rotate the projective coordinates values so that either lightness is inverted or the hue values are rotated so that inversion inverts it back.

amitmarkel commented 10 years ago

I almost got it right.

I altered the Color LCD profile as I described here https://dl.dropboxusercontent.com/u/6674137/ICC%20Modification.pdf.

https://dl.dropboxusercontent.com/u/6674137/ICC-img.jpg

jccr commented 10 years ago

@amitmarkel Thanks for looking into the color profiles. This is great stuff but may I ask as to why you removed the links to your icc profile and document? I was looking forward to trying out your modified profile..

amitmarkel commented 10 years ago

I edited the document. The colors' hue values are accurately inverted, but something is wrong with the grays. I suspect that the "Apple display native information > Phosphor values" section might be related somehow. I use the Skype icon for observation.

jccr commented 10 years ago

Oh that's cool. Looking at your screenshot, wow looks like you are getting close.

amitmarkel commented 10 years ago

Here is the profile https://dl.dropboxusercontent.com/u/6674137/Invert%20Hue.icc.

Hopefully someone can resolve the remaining little problem with lightness (I assume). Although the problem doesn't seem to be great, it does affect user experience; it makes the OS look like Yosemite.

amitmarkel commented 10 years ago

I think I forgot to invert the white point. Will do that tomorrow!

amitmarkel commented 10 years ago

I have been working on this for three days now. Tomorrow I will have limited time to do this. I hope that this will resolve the issue I mentioned.

jbenet commented 10 years ago

@amitmarkel this is a great step forward! thank you

(for others, install profile in /System/Library/ColorSync/Profiles)

I'm getting these.

just hue

with nocturne

amitmarkel commented 10 years ago

I suppose so. Will fix it tomorrow.

ejwessel commented 10 years ago

@amitmarkel Great job! Fantastic write up including references.

dmitrym0 commented 10 years ago

The profile needs to go to ~/Library/ColorSync/Profiles in Yosemite. I had to create it (upgraded from Mavericks).

amitmarkel commented 10 years ago

I don't notice a difference when inverting the media white point.

https://dl.dropboxusercontent.com/u/6674137/Invert%20Hue2.icc

How does it look on OSX 10.10?

amitmarkel commented 10 years ago

Another attempt https://dl.dropboxusercontent.com/u/6674137/Invert%20Hue3.icc

Rotated - https://dl.dropboxusercontent.com/u/6674137/Invert%20Hue.icc Rotated as well as white point - https://dl.dropboxusercontent.com/u/6674137/Invert%20Hue2.icc Almost rotated - https://dl.dropboxusercontent.com/u/6674137/ICC_Almost_Rotated_Tristimulus.icc

I'm still not sure what is wrong. Also I made lots of "redundant" computations from theory, but these can be done via the ColorSync Utility's calculator.

What I have done was this: I converted each XYZ point of the color tristimulus (red, green, blue, white) to its HSV representation (Hue Saturation and Value). Then I took the HSV point and changed its Hue value into (Hue+180) mod 360. Then I calculated back as XYZ. Now, the ICC profile's point's coordinates are inputted as whole numbers and I figured what the relation is: multiply, say the X coordinate of an XYZ point, by 2^16. (and vice versa: divide a coordinate in the binary by 2^16).

In photoshop, this works -- representing every XYZ color in HSV and then rotating it by 180˚ in hue. For an original image https://dl.dropboxusercontent.com/u/6674137/ICC_output%20original.png its transformation looks exactly like this https://dl.dropboxusercontent.com/u/6674137/ICC_output%20invert%20hue.png and so when colors are inverted it looks exactly like this https://dl.dropboxusercontent.com/u/6674137/ICC_output%20invert%20hue%20invert%20colors.png.

However, I still have one more idea to try.

amitmarkel commented 10 years ago

I haven't succeeded in rotating it in 180˚ in hue and having it being correct, but I gathered all the resources I learnt from as well as the results and my additional explanations on how to compute the values and how to input them into an ICC binary correctly here: https://www.dropbox.com/sh/hf2tnaugskcnaey/AAACZ8sfC5IM_Y3-xXXROsA9a. (Note: I do not intend to delete this folder.)

Instead of taking the Digital Image Processing I at the Technion university, I have just quickly learnt some portion of it in a few days :) -- perhaps if I'd taken the course, I would have understood this topic better, but I have already taken more points than needed to graduate and focused more on computer security.

Hopefully someone can figure out why everything "breaks down" when rotating by 180˚ on displays; perhaps it is not possible? (I certainly do not hope so of course)

Good luck.

ejwessel commented 10 years ago

@amitmarkel I'll be looking over your work. Thank you for all the time you've spent on this.

jccr commented 10 years ago

@amitmarkel Thank you for getting us this far, and for sharing everything you have learned.

kzsh commented 10 years ago

@amitmarkel Seconded! Thanks for this excellent work! And thank you for sharing it with us.

jbenet commented 10 years ago

@amitmarkel yeah, really great work!! this gets us very far!!

Do we know anyone with color theory and/ors OS X color expertise who can help figure out these last hue inversion problems?

ejwessel commented 10 years ago

Organized Data for easy viewing

Amit's work is definitely correct.

As for the browser issue(I'm using Chrome) it appears when I change to the inverted hue, it changes for a split of a second and then immediately changes back regardless of the .ICC profile loaded. I'm looking into this.

Edit: The browser issue only happens for me in Chrome.

ejwessel commented 10 years ago

As for the browser issue it seems that Chrome and Firefox do not support ICC Version 4. Safari does however. You can test your browser here

jbenet commented 10 years ago

This is disheartening:

The previous version supported ICC Version 2 and Version 4 profiles for colour management on OSX. Version 22.0.1229.79 has dropped support for version 4.

2 years ago: http://www.reddit.com/r/chrome/comments/10o42b/chrome_22_osx_drops_icc_version_4_support/

Also: https://code.google.com/p/chromium/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Pri%20M%20Iteration%20ReleaseBlock%20Cr%20Status%20Owner%20Summary%20OS%20Modified&groupby=&sort=&id=162661

Looks like we should make a Version 2 profile

jbenet commented 10 years ago

@ejwessel wait, aren't these profiles Version 2?

jbenet commented 10 years ago

Also, not just browsers. See the text difference below (this is profile + nocturne)

amitmarkel commented 10 years ago

Btw, Nocturne is not needed at this point for testing, CMD+CTRL+ALT+8 may be used to just invert colors. (might be required to enable this keyboard shortcut on Yosemite, I still have Mavericks).

jbenet commented 10 years ago

@amitmarkel nocturne removes shadows :)

amitmarkel commented 10 years ago

@jbenet oh right, but I still got used to the inverted shadows :)

ejwessel commented 10 years ago

@jbenet Nice catch. You are correct, we are using v2.0+ so perhaps thats not the issue. Which app is that btw? What other apps aren't inverting either?

amitmarkel commented 10 years ago

I located this file: /System/Library/Colors/Apple.clr/Apple.clr which is encoded in plaintext and looks like this:

11 0 0.0 0.0 0.0 1.0 Black 0 0.0 0.0 1.0 1.0 Blue 0 0.6 0.4 0.2 1.0 Brown 0 0.0 1.0 1.0 1.0 Cyan 0 0.0 1.0 0.0 1.0 Green 0 1.0 0.0 1.0 1.0 Magenta 0 1.0 0.5 0.0 1.0 Orange 0 0.5 0.0 0.5 1.0 Purple 0 1.0 0.0 0.0 1.0 Red 0 1.0 1.0 0.0 1.0 Yellow 0 1.0 1.0 1.0 1.0 White

Perhaps this file (and maybe the two others shown in the screenshots below) may be altered to achieve something.

system clr colors developer colors apple crayons clr colors crayons

dmitrym0 commented 9 years ago

Hello friends, any updates on this?

I'm volunteering myself as a guinea pig :)

amitmarkel commented 9 years ago

There's something I noticed today. I have a malfunctioning nvidia on a 2010 mbp, which I tried to disable by pulling out every nvidia-related kext (kernel extension driver).

We noticed that the grays were not accurate when these profiles were applied (neglect the hue inversion), and so they were, similarly, when I unloaded the drivers. I'm not sure if this can help, but I did notice this.

One may try this as follows: Navigate to /System/Library/Extensions/ and move out any "NVDA.kext", "GeForce.kext", "NV*.kext" files into a different folder, download and run KextUtility, and then reboot. Note that the login screen gets blank (black) so set up an automatic logon temporarily, or press DOWN and then ENTER and then type your password and then ENTER again; like I did. :) To revert, simply: move the files back, run KextUtility, and then reboot. Disable automatic logon if you like. I used KextUtility to rebuild the extensions' cache to force changes.