Jarvis icon indicating copy to clipboard operation
Jarvis copied to clipboard

Change font colour based on terminal background

Open dinanz opened this issue 2 years ago • 9 comments

Suggestion to add feature to change text colour based on terminal background colour or system theme, if possible. Currently when the background is black, the text that are in dark blue and red are almost unreadable. I'd like to suggest and try working on this: if the terminal background is detected to be black or system is set to dark theme, changee the colours to be much brighter so they are easier to read. image

dinanz avatar Apr 03 '23 01:04 dinanz

Yep, that would be nice.

I actually don't really know if detecting background color of Terminals works corss-platform (and in all kind of terminal-emulators?). If not, manual configuration of "light" and "dark" mode would also work fine for me.

Pinned this issue, since I agree we actually need this feature. I'm happy for any input ;).

Somehow related: #485

pnhofmann avatar Apr 05 '23 18:04 pnhofmann

I looked at #485 and I can see that it's a little complex to configure personalisations especially with storage... I can definitely look into detecting OS and then different functions for detecting theme based on OS if that's possible at all, and if not I suppose I can try (at least to begin with) perhaps a temporary configuration for the text colour. Thanks! :)

dinanz avatar Apr 07 '23 17:04 dinanz

@pnhofmann Hi, I'm wondering if it's acceptable if the text color itself can just be changed to a more middle-ground color that works on both white and black backgrounds? After some testing cyan seems to be a good replacement for the dark blue, and magenta to replace red. In the below cyan and magenta are pretty readable on both light/dark theme and much more readable than blue/red on a black background. image image Let me know if this is okay, or the color still needs tweaking, or detection of theme/manual config is still preferred. Thanks! :)

dinanz avatar Apr 17 '23 17:04 dinanz

That's actually a good compromise

pnhofmann avatar Apr 17 '23 17:04 pnhofmann

I'm gonna try to make a plugin that allows Jarvis to accept text commands to change text color (or just automatically does it), if that's okay with you guys? Looking to be done by either tomorrow or the day after

JustinMLu avatar Apr 17 '23 23:04 JustinMLu

@JustinMLu Hi, I'm in the middle of changing the default text colors so I'm going to finish this, but it's only minor fixes in the main file and in pluginManager. But afterwards I think if you can work on a manual config that would be great, and as a separate plugin I don't think it's going to conflict with my changes either. Thanks!

dinanz avatar Apr 18 '23 01:04 dinanz

No worries! I'm actually nearly finished with my plugin that lets you change colors manually & I don't wanna step on your toes.

I don't think our changes will conflict unless you're changing the default text colors by hard-coding the colorama constants (my default text colors are pulled from a JSON file so that user changes can persist). Even if they do, that's a trivial fix.

My plugin also adds support for preset themes (and resetting to default), so I could make your new theme the 'default theme' afterwards if you want! example-themes

JustinMLu avatar Apr 18 '23 04:04 JustinMLu

Update: I might make a more formal issue later, but I've noticed some issues with the "first_reaction" boolean (in Jarvis.py and CmdInterpreter.py).

Not only does it stay True after first_reaction_text is outputted by Jarvis, it gets set to False after the second prompt is queued. This leads to an inability to update the theme for following commands, but is simply solved by bypassing the if-statement within the postcmd() function in Jarvis.py entirely. Could I get a second opinion on this?

JustinMLu avatar Apr 18 '23 07:04 JustinMLu

@JustinMLu Have you already fixed this? I was thinking if not maybe I can take it up

speedhs avatar Jul 27 '23 06:07 speedhs