Windows New Terminal color code

1

I'm using Windows Terminal Preview to access my unix server via ssh.

I'm aware of changing color scheme but I'm not seeing any method to have any code to be colored.

for example if i did open a Python file or PHP, i would like the code to be in friendly color view.

Something like Microsoft advertisement

Check it.

Update:

Here's a screenshot of the file while i open it via nano

enter image description here

Code:

import requests
import pandas as pd

headers = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0",
    "Accept": "*/*",
    "Accept-Language": "en-US,en;q=0.5",
    "X-Requested-With": "XMLHttpRequest"
}
r = requests.get('https://www.nseindia.com/products/dynaContent/common/productsSymbolMapping.jsp?symbol=TCS&segmentLink=3&symbolCount=2&series=ALL&dateRange=+&fromDat$
df = pd.read_html(r.text)

print(df)

Update:

I've updated my file name with extension as filename.py and tried with a shebang as #!/usr/bin/python3 and even yet I couldn't get the code colored!

The output of echo "$TERM" is xterm-256color.

printf '\e[%smfoo\n' 31 32 34 0 generates colors as expected.

αԋɱҽԃ αмєяιcαη

Posted 2019-12-19T07:07:51.793

Reputation: 197

are you using a cmd or powershell window? the powershell window with ssh may give you color where the cmd one would not. – LPChip – 2019-12-19T07:41:19.723

@LPChip am using powershell window – αԋɱҽԃ αмєяιcαη – 2019-12-19T07:42:55.343

What happens if you use OpenSSH through Powershell? I know OpenSSH supports colors, I think cmd's SSH (which you are using now) does not. – LPChip – 2019-12-19T07:45:22.443

Does this answer your question? OpenSSH via powershell - vi turns prompt blue

– LPChip – 2019-12-19T07:46:01.063

@LPChip I'm pretty sure that am using powershell window check and regarding OpenSSH via powershell - vi turns prompt blue is one of things which I've checked before i open the question.

– αԋɱҽԃ αмєяιcαη – 2019-12-19T08:06:48.867

There is this question but I doubt it will help since printf is able to generate colors. In nano Meta+y (LeftAlt+y) toggles syntax coloring, please check if you can enable it. Additionally nano needs to know about syntaxes. In my Kubuntu /etc/nanorc states include "/usr/share/nano/*.nanorc", the syntaxes are specified there. I don't know how rich your server is. It's possible it saves space by missing these files or providing nano without the functionality. I know vim less, for now I wont elaborate.

– Kamil Maciorowski – 2019-12-19T09:08:24.553

@KamilMaciorowski thanks a lot, i did un-comment the following line in the file include "/usr/share/nano/*.nanorc" and now it's works. note that the file should have .py to recognize it or to include shebang inside it. – αԋɱҽԃ αмєяιcαη – 2019-12-20T10:02:08.527

No answers