Carglglz / upydev

Command line tool for MicroPython devices
https://pypi.org/project/upydev/
MIT License
57 stars 9 forks source link

local echo is in white #18

Open Naohiro2g opened 3 years ago

Naohiro2g commented 3 years ago

I tried sh_srepl and the connection established successfully but I got no echo back to the terminal.
No, it was there but in white. If I changed the color theme from light to dark, it turned to visible.

It seems the character color for the local echo is hard coded to white.

The target is ESP32 and I'm on macOS Mojave with iterm2 app.

Carglglz commented 3 years ago

Hi @Naohiro2g, thanks for reporting this issue.

It seems the character color for the local echo is hard coded to white.

That is true and I didn't realise this wouldn't allow to use a light color theme. 🤦

The target is ESP32 and I'm on macOS Mojave with iterm2 app.

This is actually my setup too.

The prompt style is defined at :

https://github.com/Carglglz/upydev/blob/a07d5966fc4cd132bdc769a73ccd3b2476a0a2bf/sh_srepl_dir/bin/sh_srepl#L664

# PROMT SESSION CONFIGURATION

# Style
style_p = Style.from_dict({
    # User input (default text).
    '':          '#ffffff',

    # Prompt.
    'userpath': 'ansimagenta bold',
    'username': 'ansigreen bold',
    'at':       'ansigreen bold',
    'colon':    '#ffffff',
    'pound':    'ansiblue bold',
    'host':     'ansigreen bold',
    'path':     'ansiblue bold',
})

It's the hexadecimal color code under # User input (default text)

I will introduce an option to change the colors in the next release, but for now you could clone the repo and modify it at will 👍 .

Naohiro2g commented 3 years ago

Thank you for the confirmation. The setting for colon seems the same. I assume you don't have to specify the attributes then it will fall back to the user settings, right?

upydev wrepl is away from this. I'm using iTerm2 in VS Code, so it's the same situation as in iTerm2.

Carglglz commented 3 years ago

Thank you for the confirmation. The setting for colon seems the same. I assume you don't have to specify the attributes then it will fall back to the user settings, right?

I guess so, but I haven't checked that yet.

upydev wrepl is away from this. I'm using iTerm2 in VS Code, so it's the same situation as in iTerm2.

Yes for the SHELL-REPLS I'm using a custom prompt to set the colors of the shell and change from shell to repl mode.

For wrepl I only introduced key bindings for custom shortcuts, the prompt is default repl >>> prompt so I guess it follows user settings.

If you are interested this is the library I use for this shell-repl modes : https://python-prompt-toolkit.readthedocs.io/en/master/

Naohiro2g commented 3 years ago

Thanks. Custom settings for the prompt is a nice idea and I like it. The green is good in the light theme, too. User input and colon should be in gray or light gray, or remain in colors as defined in the theme. The python prompt toolkit looks great.

By the way, I'm waiting for my Raspberry Pi Pico coming. Did you get one? I'm thinking to add REAMDE in Japanese to uPydev for my classes. Or extension for VS Code??

Carglglz commented 3 years ago

Custom settings for the prompt is a nice idea and I like it. The green is good in the light theme, too. User input and colon should be in gray or light gray, or remain in colors as defined in the theme. The python prompt toolkit looks great.

Yes it shouldn't be too difficult to implement a config file for the prompt colors, perhaps something like the upy-config command in the shell-repl mode.

By the way, I'm waiting for my Raspberry Pi Pico coming. Did you get one?

Not yet but I'm planning to do so. 👀

I'm thinking to add REAMDE in Japanese to uPydev for my classes.

Yes, every contribution is welcome. 🎉

Or extension for VS Code??

I don't know how to do that, but I know you can configure a file with keyboard shortcuts to work with the terminal, (for example to upload a script or run code in the device, see HOWTO