question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do we customize the color scheme for ipdb?

See original GitHub issue

Related: #50, #144, #57, #1

By searching around, I understand (probably incorrectly) that ipdb should use ipython’s color scheme by default. And that ipython use pygments styles.

So I tried the following:

  • ipython profile create
  • pygmentize -L style
  • vim profile_default/ipython_config
    c.TerminalInteractiveShell.highlighting_style = 'tomorrownight'
    

Within the same virtualenv, I get colors within ipython, but not within ipdb:

image

image

The prompt seems to be another matter, and I haven’t figured out how to change its color yet.

Therefore, I have 2 related questions:

  • Why doesn’t ipdb pick up the ipython pygment style? Else how can I override the ipdb shell colors?
  • How can I modify the ipdb prompt color?

Thanks for your help in advance!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gotchacommented, Jan 21, 2020

I have never tried to customize IPython or ipdb colors myself.

I am sorry I cannot help and hope you’ll report here if you succeeds.

0reactions
zacharesmercommented, Oct 3, 2020

I went down this rabbit hole yesterday, and the solution does lie within IPython. IPython uses two different color schemes: one is Pygments, and the other one is changed through c.InteractiveShell.colors in the config file. For the second one there are very limited options and they only use basic 8-bit colors, presumably for compatibility. Using different ANSI escape codes, you can get a lot of much nicer colors depending on what your terminal supports.

If you compare this to master, you can see all the files that need to be changed to add the theme. It’s probably possible to do all of that through the config file, but I’m not sure how.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - How do we customize the color scheme for ipdb? -
By searching around, I understand (probably incorrectly) that ipdb should use ipython's color scheme by default. And that ipython use pygments styles.
Read more >
How can I turn off color in ipdb? - Stack Overflow
Old answer - insert this into code (2019, doesn't work): import ipdb; ipdb.def_colors='NoColor'; ipdb.set_trace().
Read more >
Better Python Debugging With IPDB - Hasil Sharma
Searching for a better approach to debug code, there is always something better available out there, I came across pdb and ipdb.
Read more >
Colors and fonts | PyCharm Documentation - JetBrains
You can use a predefined color scheme or customize it to your liking. It is also possible to share schemes. Select a color...
Read more >
Williams 'Blackout' - Internet Pinball Machine Database
The first game designed and produced with Lane Change was Williams' 1980 'Firepower'. ... His usage of color influenced me for the rest...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found