napari / napari-console

A plugin that adds a console to napari
BSD 3-Clause "New" or "Revised" License
3 stars 12 forks source link

Fontsize option for the console #32

Closed jules-vanaret closed 3 days ago

jules-vanaret commented 8 months ago

Hi! First, I don't know if this issue (actually more of a feature request) belongs to this repo or the main Napari repo, so please redirect me if this is not the right place.

After a fresh install of Napari with the latest version, I found that the default font size of the text in the console is much smaller. I have rather bad eyesight, so that impacts me quite a bit... 😅

Is there any way to change the font size ? The font size parameter in the "Preferences" panel only affects Viewer fonts, not the console. If no way currently exists, is it possible to add this feature ?

Czaki commented 8 months ago

Currently, only bad hack:

font = viewer.window._qt_viewer.console._control.font()
font.setPointSize(20)
viewer.window._qt_viewer.console._control.setFont(font)

Yes, it is possible to add such feature. It will require fix qss in napari napari/_qt/qt_resures/styles/_02_custom.qss with add font: {{ font_size }}; to QtConsole > QTextEdit entry and then fix console to use font size when applying style sheet.

jules-vanaret commented 8 months ago

Huge thank you @Czaki ! Though only a hack, this is a life saver for me before the option is implemented. Cheers

brisvag commented 8 months ago

Would be nice to attach this to the theme! napari themes already have a syntax_style that affects the console and a font_size that affects the rest of the gui, so all the machinery should be easy to add to either use font_size for the console too, or provide a second value just for the console.

Czaki commented 8 months ago

There is two things. Adding depending on theme for this it is a single line in qss. The bigger play is to also depends on settings state, as we allow to overwritte theme font size for application without mutation theme object itself.

brisvag commented 8 months ago

Yes, same discussion as https://github.com/napari/napari/pull/6689#issuecomment-1991935370 basically.

Czaki commented 8 months ago

Similar. Font resizing is already implemented.

dalthviz commented 8 months ago

Hi there, just in case, I think that a workaround for the moment is to use the console Zoom In (Ctrl++ console shortcut). Also, to do Zoom Out I think the shortcut is Ctrl + - and to reset the Zoom you can use Ctrl + 0. So, using those shortcuts, you should be able to experience something like:

console_zoom

jules-vanaret commented 8 months ago

Hi there, just in case, I think that a workaround for the moment is to use the console Zoom In (Ctrl++ console shortcut). Also, to do Zoom Out I think the shortcut is Ctrl + - and to reset the Zoom you can use Ctrl + 0. So, using those shortcuts, you should be able to experience something like:

Nice! Before writing the issue I thought this didn't work because I was trying ctrl ++, turns out it is ctrl shift + on my computer. Thank you very much.