Comments (15)
It seems that the way you pass those arguments changed in jupyter4.
Instead of c.IPythonQtConsoleApp.stylesheet
, use c.JupyterQtConsoleApp.stylesheet
, and instead of c.IPythonWidget.syntax_style
, use c.JupyterWidget.syntax_style
in your ~/.jupyter/jupyter_qtconsole_config.py
file. The stylesheet should be applied correctly.
from qtconsole.
Actually, I had already made this change, and this is not enough.
from qtconsole.
Note that the docs page at http://jupyter.org/qtconsole/stable/#colors-and-highlighting are quite wrong now -- there is the same issue of illegible backtraces with the pygments builtin schemes used as an example (so it's not an issue with zenburn); moreover, jupyter qtconsole -h
does not print out a list of pygments style names, and the %colors magic is no more (if I understand correctly).
from qtconsole.
Kindly bumping the issue.
from qtconsole.
The issue is that it is now separate configuration how IPython colors its tracebacks and how the qtconsole colors what it's in control of. The problem stems from the fact that IPython hardcodes the colors of outputs, which it shouldn't. The InteractiveShell.colors = "linux"
configuration in IPython changes IPython's coloring to expect a dark background (%colors linux
at runtime). This is the same as picking a dark or light background in your terminal emulator - IPython doesn't know what color the terminal is, you have to tell it what colors to produce. QtConsole is a peer of the terminal emulator in this regard, and IPython must be told what colors to send.
QtConsole could use a different ANSI color table when the background is dark. That might alleviate the situation somewhat.
from qtconsole.
I don't know much about the architecture here but perhaps it would make sense for the kernel to output some kind of markup'd text and let the frontend use that markup for coloring?
from qtconsole.
OK, I made some progress there, and found that this is actually a PyQt4 vs PyQt5 issue.
Basically, JupyterWidget._style_sheet_changed (called also at the beginning, when the style sheet is set) calls AnsiCodeProcessor.set_background_color with the new background color; if the background color is "light" (V <= 127) then "bright" colors are folded into "normal" colors (which sounds reasonable).
The background color is obtained via bg_color = self._control.palette().window().color()
; unfortunately, when the backend in PyQt5, this returns white (which is interepreted as a "light" color and thus disables "bright" text) instead of the actual background color. Not sure why, though.
from qtconsole.
On a related topic, it would be nice to indicate how the config items JupyterQtConsoleApp.stylesheet
and JupyterWidget.style_sheet
interact. It seems that they are basically interchangeable (except that one takes a path and the other the file's contents, until one chooses to embed the QtConsole in a Qt app; then JupyterQtConsoleApp.instance(config=config).init_colors(widget)
only uses JupyterWidget.style_sheet
.
from qtconsole.
Hey guys, is there any workaround of this? I have the same problem and whatever I tried in both jupyter config and ipython config, I was still not able to tell the AnsiCodeProcessor to use dark background. I have c.InteractiveShell.colors = 'linux'
in ipyton_config file and c.JupyterWidget.syntax_style = "monokai"
in jupyter but that does not help. Is there anyway to call self._ansi_processor.set_background_color(bg_color)
with a dark color (basically with an ibject that has a .value() method that returns some number less than 127) in any of the config files?
from qtconsole.
@anntzer @ekipmanager can you help me test PR #195? Does it fix the issue for you?
from qtconsole.
FWIW I cannot reproduce the issue locally anymore -- not sure why, though.
from qtconsole.
@anntzer are you running qt4 or qt5?
from qtconsole.
@anntzer more importantly: do things still work fine for you after merging #195?
from qtconsole.
qt5, and yes.
from qtconsole.
@wmvanvliet Sorry for the delay. I checked and it solves my problem. I rolled back to the current master and the problem was back again so this PR is definitely working 👍
from qtconsole.
Related Issues (20)
- qtconsole packaged into .app macOS bundle using py2app
- Crash on PySide6 due to version checking HOT 1
- Catching Ctrl-Z and Ctrl-\
- Question: Removal of ipython_genutils HOT 1
- Values missing from console when running automatically
- AttributeError: 'QtInProcessChannel' object has no attribute 'closed' HOT 2
- How to access objects in my application follow the example qtconsole/examples/inprocess_qtconsole.py? HOT 2
- Qt bindings version outdated in documentation HOT 2
- Matplotlib Qt5Agg backend is given anonymous icon when used with qtconsole on macOS HOT 3
- Weird pytest error: 'CompletionHtml' object has no attribute '_text_edit' HOT 4
- Qtconsole quits when trying to drag in PyQt6 HOT 12
- Segmentation Fault on `jupyter qtconsole` HOT 10
- Stop using `IPythonLexer` from ` IPython.lib.lexers` HOT 3
- TypeError due to wrong spelling in keyword HOT 1
- compute_item_matrix() got an unexpected keyword argument 'displaywidth' HOT 1
- New tab causes crash for --existing kernels
- intersphinx warning HOT 1
- possibly removing `qtconsole` from jupyter metapackage HOT 2
- Horizontal scrolling not updated until wndow resize event HOT 3
- misspelled keyword arg in qtconsole.util.compute_item_matrix HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qtconsole.