-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix high contrast render in midnight mode #197
Conversation
Uses the Lightness values from the `pdf-view-midnight-colors` `fg` and `bg` to scale the inverted color's lightness. Band-aid till better method is found. Related to: vedang#69
I'll add this here as well, so you don't have to head over to the related PR. It tries to make the #69 implementation better by trying to respect the user configured Here, the bottom part of the image is when I have inverted the PDF. This is on: I haven't tested it for a variety of colors, but in theory this should work. This should at least act as a band-aid for the sudden change to high contrast rendering that doesn't respect user configurations. And it might be a good idea to add that only lightness value is used in the documentation. |
No, I didn't. I may have some extra time starting next week if someone else
doesn't look at it first.
…On Sat, Mar 25, 2023, 20:46 Zero ***@***.***> wrote:
@fw623 <https://github.com/fw623> @smithzvk <https://github.com/smithzvk>
Did you guys test this out? Does this work, or do you have some suggestions?
—
Reply to this email directly, view it on GitHub
<#197 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACIUR46IOH76WXDEKMKEFLW56NVXANCNFSM6AAAAAAVODFLSM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Hi @vedang, you're probably busy, but can you look into it? The new default with oklab color inversion is great, so people like me are reluctant to go back to the old behavior where the customization colors are respected, but images are grayscale. I've made this modification as soon as I updated pdf-tools and came across it. And I've been using it for almost a month, and it works well for my use cases. Others might benefit from it too. |
Ok, I took a look at this and it looks like it solves the issue. I made some changes which I think are improvements. I can't tack them onto this PR as I'm not a maintainer of this software. Please look here for a commit which you can try out and add if you like it (I certainly do): High contrast I was bugged that it didn't pick up the hue from the background, however, so I made the all color a/b parameters start from the a/b parameters of the BG color. This makes the PDF background (white) map to your BG color and PDF foreground (black) map to your FG color, which can be set to your theme background making it seem pretty seamless. Note that if you set your BG and FG to a color theme without zero saturation (a gray tone of some sort), then you recover the original behavior. I also reinstated the cached transforms for background and the last color computed. I also refactored the loop to move the switch statement outside of the loop. It is more repetitive, but it was needed to get rid of some warnings about potentially uninitialized variables. It should also be faster as the branch was removed from the loop. I also ditched the gamma correction as it seemed to be doing the wrong thing and I never had a theoretical reasoning for it. I can get similar results if I just set my BG color to something like gray5 instead of black. Barely a difference in background but the hinting on the fonts is showing again. The root of my issue may have always been some kind of display calibration issue. |
Merge new changes in https://github.com/smithzvk/pdf-tools
@smithzvk Thank you for checking it out and the addition of the color as well instead of just the lightness from fg and bg. Out of topic but thank you for introducing the oklab inversion and your initial code, I took that code to write a shader for picom and now I can use this inversion on any window if they don't have dark mode. It's great. |
@vedang Just FYI, you didn't request a review, but I think this looks pretty good. Let me know if there is anything I can do to help move this forward. @Atreyagaurav thanks. Out of modesty, I'll point out that all I did was scratch my own itch using a bunch of work done by someone else (Björn Ottosson, Emacs, and Pdf-Tools). The capability you describe with picom makes me want to try it, thanks for pointing it out. A lot of software out there is broken in terms of dark themes (Ghidra, GNU Radio, GMAT, most Java stuff that isn't JavaFX based). |
@vedang Hi. It has been a really long time, could you find a little bit of your time to review it and possibly merge it? I'm sure the unexpected change in default has other people also wondering why their config is broken. @smithzvk Open source is all about trying out things based on the other people's prior work so you definitely deserve the credit for making this possible. And let me know (my contact info is in my readme) if you tried the picom thing, it's working great for me on qpdfview. I'm sure it'll do well in other ones as well. |
Thank you for the work @Atreyagaurav ! I will review the change this week and merge it in :( I'm sad about the fact that I am not able to give much time to |
Uses the Lightness values from the
pdf-view-midnight-colors
fg
andbg
to scale the inverted color's lightness. Band-aid till a better method is found.Related to: #69