Skip to content
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

Restore the original palette on exit #285

Closed
dankamongmen opened this issue Jan 18, 2020 · 4 comments
Closed

Restore the original palette on exit #285

dankamongmen opened this issue Jan 18, 2020 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dankamongmen
Copy link
Owner

Now that I've added palette color support (#230) and am working on a suitable demo (#253), we have a crap palette upon exit from notcurses-demo. We need to restore it on exit. The oc termcap string resets the palette to the original colors. I'm not sure whether that means "colors on startup of application" or "default colors of terminal". Ideally I'd think we'd try to do the first option.

@dankamongmen dankamongmen self-assigned this Jan 18, 2020
@dankamongmen dankamongmen added this to the v1.1.0 milestone Jan 18, 2020
@dankamongmen dankamongmen added the bug Something isn't working label Jan 18, 2020
dankamongmen added a commit that referenced this issue Jan 19, 2020
* palette_set: update pal256 damage map #230
* drone: use newest builders
* palette: send oc on exit for color reset #285
* palette_new: copy existing palette in #230
* Python: use checkRGB everywhere
* more palette unit testing
* add ncplane_set_*_palindex()
* render fg palindex #230
* palette index color is out of 1000
* jungle demo works #253
@QuLogic
Copy link

QuLogic commented Jul 28, 2020

Unfortunately, it seems to be default colours of terminal, not colours from before the application started.

@dankamongmen
Copy link
Owner Author

Unfortunately, it seems to be default colours of terminal, not colours from before the application started.

Indeed. It would be desirable to get the colors from entry. I'll look into whether I can extract them on startup (in some cases, at least). Unfortunately, I seem to recall looking into this, and reading the palette on startup returns the console default palette. In that case, I don't see any way for me to retrieve the active palette, except perhaps for highly terminal/DE-specific mechanisms (which I'd really rather not get into if I can avoid them).

If you see this as a major problem, or even a minor one I suppose, feel free to create a new issue explicitly calling for restoration of the palette as we found it. I'll investigate what can be done. Thanks, @QuLogic !

@QuLogic
Copy link

QuLogic commented Jul 28, 2020

It's not a super high priority; I was just trying to figure out how to stop ncurses from doing the same. I was looking at notcurses as an alternative, but haven't really committed to switching out anything.

@dankamongmen
Copy link
Owner Author

It's not a super high priority; I was just trying to figure out how to stop ncurses from doing the same.

Hah, I had the same question eight years ago:

https://stackoverflow.com/questions/8686368/how-can-the-original-terminal-palette-be-acquired-preferably-using-ncurses-rout

Unless I've overlooked something over 9 months of Notcurses development (totally possible) and a decade of NCURSES development prior to that, there's no way to do this portably. Doing it properly involves horrors like extracting palette settings from gnome databases, and even then you're not guaranteed to be recovering the true palette of application start.

Sorry! Do let me know if you find out otherwise...but I won't be holding my breath =[.

I was looking at notcurses as an alternative, but haven't really committed to switching out anything.

Well, I'm currently trying to get Notcurses established, so if you decide to go that route, feel free to mail me directly (or here) with any problems/comments. I'll be happy to help you along.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants