Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working in windows 10 #2

Closed
outcastdreamer opened this issue Mar 31, 2018 · 13 comments
Closed

Not working in windows 10 #2

outcastdreamer opened this issue Mar 31, 2018 · 13 comments

Comments

@outcastdreamer
Copy link

I tried the example codes in python3 running in my cmd in windows 10 but it doesn't print the string which I have mentioned as show n in the screenshot. Kindly find a solution for this!!
hmm

@sharkbound
Copy link

its not really a fix, but the portable CMD program called cmder works with the sty color codes:

sty with cmder

@feluxe
Copy link
Owner

feluxe commented Apr 26, 2018

@sharkbound This is good news. cmder really looks promising, I'm glad it works with sty. Thanks for pointing this out!

@outcastdreamer I got myself a windows license. I'll investigate this in a VM.

@Nikedi
Copy link

Nikedi commented Sep 1, 2018

I got it to work by importing init from colorama. Like this:
from colorama import init
init()

@pidugusundeep
Copy link

I got it to work by importing init from colorama. Like this:
from colorama import init
init()

With this it works perfect ! thanks @Nikedi

@feluxe
Copy link
Owner

feluxe commented Feb 2, 2019

I'm planning to add windows support via the Environments & Feature Sets interface. This will offer a way to get windows compatible register-objects (fg, bg, etc.). It'll make use of sty's customization abilities and unlike colorama.init() it will not alter the terminal session globally (like reported here #15).

I'll add Environments & Feature Sets to sty as soon as I'm certain about the interface for it.

@mcaay
Copy link

mcaay commented Feb 5, 2019

Noticed interesting things using cmder.
If you use colorama to "make it work on windows" it acutally blocks some functionalities, like assigning 8 bit colors to your custom names.
sty windows cmder
And either way, 8 bit colors get approximated to one of the few SGR (?) colors (here it outputs red, while it should be orange).

@feluxe
Copy link
Owner

feluxe commented Feb 6, 2019

@mcaay Thanks for posting this.

If you use colorama to "make it work on windows" it acutally blocks some functionalities, like assigning 8 bit colors to your custom names.

I guess this is related to #15. When #16 is done, we can omit colorama.init() and the issues that come with it.

And either way, 8 bit colors get approximated to one of the few SGR (?) colors (here it outputs red, while it should be orange).

Some terminals do that as a way to support 8bit color and RGB (true color) ANSI sequences.

@feluxe
Copy link
Owner

feluxe commented May 7, 2019

Microsoft announced that Windows gets a new Terminal: https://devblogs.microsoft.com/commandline/introducing-windows-terminal

Let's hope it's compatible to the ANSI sequences that most other terminals use.

@sharkbound
Copy link

@feluxe i hope so, right now as it is, windows terminals is a mess of what is best for the job, sometimes you need GIT shell, sometimes CMDER, powershell, cmd, ect.

i hope this new one will be a one-in-all solution

@plastictortoise
Copy link

plastictortoise commented Jun 13, 2019

@feluxe
@mcaay
@sharkbound

If you use colorama to "make it work on windows" it actually blocks some functionalities, like assigning 8 bit colors to your custom names.

You don't need to use the colorama module to make it work on windows.

If you add this near the top, then sty works on cmd (and cmder) and doesn't block any functionalities:

import os, sys
if sys.platform == "win32":
    os.system('color')

Better fix: #2 (comment)

@feluxe
Copy link
Owner

feluxe commented Feb 6, 2020

@simplebinary This is great! Thanks for leaving this here. I just tried and it seems to work very well. With this fix cmd even supports 8bit and RGB colors. I linked your comment in the docs/README.

I close this issue, because @simplebinary solution seems nice. Plus, the new Windows Terminal will hopefully soon be shipped and I'm sure it will work with sty out of the box.

Thanks to everyone for your helpful comments!

@feluxe feluxe closed this as completed Feb 6, 2020
@shakeyourbunny
Copy link

The "new Windows Terminal" is only available on Windows 10, so other users of Windows are booted out.

@plastictortoise
Copy link

plastictortoise commented Jun 6, 2020

@feluxe Actually, an even better fix is available:

import os

os.system("")

It doesn't actually require the color call, and with the blank call, no sys module is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants