jupyter / jupyter_console

Jupyter Terminal Console
http://jupyter-console.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
248 stars 146 forks source link

Jupyter console configuration for colors #156

Open unode opened 6 years ago

unode commented 6 years ago

Ipython has c.InteractiveShell.colors and %colors.

With jupyter-console only %colors seems to be available. This option seems to have existed in jupyter console 4.0.1 but not on the latest.

Otherwise the only reference I've managed to find so far on google groups mentions its use but with a different goal: --simple-prompt.

With that said, is there any way to configure jupyter-console to always use a given colorscheme?

unode commented 6 years ago

Actually I correct my previous post. %colors (e.g %colors Linux) seems to have no effect in jupyter-console - 5.2.0, so there seems to be a problem here too.

takluyver commented 6 years ago

There are two sources of colours

ianliu commented 5 years ago

I was able to change the colors and font by launching the Developer Console and typing:

terminal.term.setOption('fontFamily', 'Fira Code');
terminal.term.setOption('theme', {
  foreground:    '#d4d4d4',
  background:    '#2d2d2d',
  black:         '#646464',
  brightBlack:   '#646464',
  red:           '#f58e8e',
  brightRed:     '#f58e8e',
  green:         '#a9d3ab',
  brightGreen:   '#a9d3ab',
  yellow:        '#fed37e',
  brightYellow:  '#fed37e',
  blue:          '#7aabd4',
  brightBlue:    '#7aabd4',
  magenta:       '#d6add5',
  brightMagenta: '#d6add5',
  cyan:          '#79d4d5',
  brightCyan:    '#79d4d5',
  white:         '#d4d4d4',
  brightWhite:   '#d4d4d4',
});

I was also able to hide the scrollbar by replacing the overflow-y: scroll with overflow-y: hidden style from .terminal .xterm CSS class. See the screenshot below:

screenshot from 2018-11-13 12-07-05

I'm willing to create a PR to enable these options in the Jupyter Console configuration, but I need some time understanding how to do this as I've never worked with Jupyter Extensions. If anyone can give me any hints, I'll be very happy :smile:

alayamanas commented 5 years ago

I was able to change the colors and font by launching the Developer Console and typing:

terminal.term.setOption('fontFamily', 'Fira Code');
terminal.term.setOption('theme', {
  foreground:    '#d4d4d4',
  background:    '#2d2d2d',
  black:         '#646464',
  brightBlack:   '#646464',
  red:           '#f58e8e',
  brightRed:     '#f58e8e',
  green:         '#a9d3ab',
  brightGreen:   '#a9d3ab',
  yellow:        '#fed37e',
  brightYellow:  '#fed37e',
  blue:          '#7aabd4',
  brightBlue:    '#7aabd4',
  magenta:       '#d6add5',
  brightMagenta: '#d6add5',
  cyan:          '#79d4d5',
  brightCyan:    '#79d4d5',
  white:         '#d4d4d4',
  brightWhite:   '#d4d4d4',
});

I was also able to hide the scrollbar by replacing the overflow-y: scroll with overflow-y: hidden style from .terminal .xterm CSS class. See the screenshot below:

screenshot from 2018-11-13 12-07-05

I'm willing to create a PR to enable these options in the Jupyter Console configuration, but I need some time understanding how to do this as I've never worked with Jupyter Extensions. If anyone can give me any hints, I'll be very happy 😄

Hi, I want to change the color of jupyter terminal page , and your picture shows

terminal.term.setOption('fontFamily', 'Fira Code');

Hi, I'm looking for a way to change the jupyter terminal page's color and font, luckily, I found this issue and your picture's url seems to be jupyter terminal page, I tried your code in jupyter console and terminal , both failed, could you please tell me how to do that please? Thanks

takluyver commented 5 years ago

Just for reference, this jupyter_console repository is for a Jupyter frontend that runs in a terminal. It's nothing to do with the HTML terminal you can get as part of the Jupyter Notebook interface. That is implemented by xtermjs, and integrated into Jupyter in the jupyter/notebook repo.

alayamanas commented 5 years ago

Just for reference, this jupyter_console repository is for a Jupyter frontend that runs in a terminal. It's nothing to do with the HTML terminal you can get as part of the Jupyter Notebook interface. That is implemented by xtermjs, and integrated into Jupyter in the jupyter/notebook repo.

Thank you for the infomation, I have already done.

flying-sheep commented 5 years ago

The only config I found for the prompt colors is ZMQTerminalInteractiveShell.true_color, but there’s none to set it to 8 colors. The green it uses clashes with my terminal background, prompts are near invisible.

flying-sheep commented 4 years ago

Ah, so I need to override this:

# ~/.ipython/profile_default/ipython_config.py
from pygments.token import Token

c = get_config()

c.TerminalInteractiveShell.highlighting_style_overrides = {
    Token.Prompt: '#ansigreen',
    Token.PromptNum: '#ansidarkgreen bold',
    Token.OutPrompt: '#ansired',
    Token.OutPromptNum: '#ansidarkred bold',
}

Why is this not the default?

References:

mjkramer commented 4 years ago

I'm finding that in Jupyter Console 6.1.0 (IPython 7.12.0, Python 3.7.6), c.TerminalInteractiveShell.highlighting_style_overrides (as suggested by the auto-generated ipython_config.py) is not being picked up by ZMQTerminalInteractiveShell. Using c.ZMQTerminalInteractiveShell doesn't work either. It seems like the entire configurability of ZMQTerminalInteractiveShell is broken.