python-control / python-control

The Python Control Systems Library is a Python module that implements basic operations for analysis and design of feedback control systems.
http://python-control.org
BSD 3-Clause "New" or "Revised" License
1.68k stars 422 forks source link

Change font color for transfer function result #658

Open 2black0 opened 2 years ago

2black0 commented 2 years ago

image

How to change font color to tf result printed in ipython (spyder 5)?

bnavigator commented 2 years ago

This is a case of https://github.com/ipython/ipython/issues/9451: Ipython's rendering of sys._repr_latex_() is not governed by the Sympy settings.

roryyorke commented 2 years ago

What console or terminal emulator is that? On my (Ubuntu) system, in jupyter console I get a repr output, and jupyter qtconsole always has a white background. In a Jupyter Notebook terminal with dark theme, the font is white.

bnavigator commented 2 years ago

Spyder with the default black theme: https://www.spyder-ide.org

Their setup has some init code for Sympy, but it doesn't help us: https://github.com/spyder-ide/spyder/issues/3798

bnavigator commented 2 years ago

To be fixed by https://github.com/spyder-ide/spyder/pull/16957.

oscargus commented 2 years ago

You can for now execute %colors Linux in you console which should trigger slightly lighter colors (although the rendering is not that nice).

bnavigator commented 2 years ago

@oscargus, did you check that advice in Spyder? Because it does not seem to have an effect there.

oscargus commented 2 years ago

@bnavigator You are correct. I mixed up where it actually helped (SymPy uses it as a guess if no color is provided when doing init_printing(), but not IPython). Your PRs are what I had in mind as a follow-up when doing the color extensions in IPython, but never got around to dig into (primarily as it worked with SymPy and I wasn't aware of any other package relying on it). Thanks!

Still a bit surprising that @2black0 gets black printing though as the "ugly white outline" was expected.

(Got stuck with a crash when looking at using the matplotlib backend which currently seems to crash, at least on my Windows laptop, https://github.com/matplotlib/matplotlib/issues/22006 )

oscargus commented 2 years ago

Btw, it seems like matplotlib are not directly supporting a color argument anymore in the replacement function https://github.com/matplotlib/matplotlib/blob/c2a5e22baf6eeb4c5e49028d8ef10adf5a6f4f32/lib/matplotlib/mathtext.py#L566