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

colorize pmenu #3

Open
dalanicolai opened this issue Mar 16, 2019 · 2 comments
Open

colorize pmenu #3

dalanicolai opened this issue Mar 16, 2019 · 2 comments

Comments

@dalanicolai
Copy link

dalanicolai commented Mar 16, 2019

Would it be possible to implement an option to colorize the menu? So that for example ls --color | pmenu would be rendered in color. Or alternatively maybe an option to colorize the menu with grc and grcat could be implemented?

The colorcodes from ls --color are passed to the input_items: print(input_items) after the input_items assignment returns colored output. However the function: result = redirect_stdio(lambda: curses_wrapper(main)) somehow results in colorless output

@sgtpep
Copy link
Owner

sgtpep commented Mar 18, 2019

Hi @dalanicolai! I've looked into whether it's possible to bypass some pre-existing escape sequences (like colors) to curses in python, but looks like there's no easy way to output test with them in curses. For instance: https://stackoverflow.com/questions/27464023/how-to-use-ansi-escape-codes-inside-mvwprintw-in-ncurses/27475218#27475218. If I understand it right, for that we need to parse escape sequences out and then emulate their effects using primitives and attributes from curses. It makes this solution not portable and error-prone.

@sgtpep
Copy link
Owner

sgtpep commented Mar 18, 2019

Maybe there're some alternatives but I'm not sure. Judging by this issue fzf supports it with --ansi option. PathPicker maybe, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants