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

Unable to output boldface and some colors from executing python script in qtconsole. #273

Closed
chrisgmorton opened this issue Feb 16, 2018 · 5 comments · Fixed by #611
Closed
Labels
Milestone

Comments

@chrisgmorton
Copy link

chrisgmorton commented Feb 16, 2018

How would I go about setting a boldfaced text output? The ansi escape sequence does not work:
print('\033[1m This should be boldface.')
You also cannot use HTML or Markdown as neither of these work in qtconsole.

How would I go about outputting a foreground color of yellow?

print('\033[31m This is red.')
print('\033[32m This is green.')
print('\033[33m This is red but is supposed to be yellow.')

I noticed there is some history regarding ansi escape sequences and making text readable when using light or dark background terminal colors.

Is there a way to set boldface and yellow?

@chrisgmorton
Copy link
Author

I looked at ansi_code_processor.py and I can see an effort to keep output readable depending on the brightness of the background terminal color. My reference above to red being output rather than yellow is not quite correct. It is actually intentionally outputting brown which is hard to distinguish from red on a white background. It does not look like any effort was made to support boldface.

It's a shame there does not seem to be a way to allow the user direct control of output (color and other formatting) unless I'm missing something with HTML capability.

@chrisgmorton
Copy link
Author

chrisgmorton commented Feb 23, 2018

Looking through ansi_code_processor.py further I see that true 24-bit colors are supported through ansi escape sequences.

print('\033[38;2;255;255;85m This is yellow.')

I suppose the bug here is that there seems to be no documentation on this at least that I could find online.

@dalthviz
Copy link
Collaborator

dalthviz commented Jun 16, 2024

Note: I think the colors part on this issue is partially caused due to the mapping (from ANSI code values to svg color names) done at:

3 : 'brown', # yellow

Changing the color name assigned to the ANSI code 3 (which should represent yellow) from a brown value to something like gold should make things look better

@dalthviz
Copy link
Collaborator

dalthviz commented Jul 5, 2024

Note: The bold code is being ignored since that's the default:

# Whether to increase intensity or set boldness for SGR code 1.
# (Different terminals handle this in different ways.)
bold_text_enabled = False

Maybe this should be set to True by default @ccordoba12 ?

@ccordoba12
Copy link
Collaborator

Yep, it seems that should fix this issue.

@dalthviz dalthviz added this to the 5.6.0 milestone Jul 5, 2024
@ccordoba12 ccordoba12 added the bug label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants