Giter Site home page Giter Site logo

Comments (8)

pfmoore avatar pfmoore commented on May 22, 2024 2

Hmm, it seems to only show blocks of colour for what appear to be the basic 16 colours - things like "grey93" just show as black. And then it aborts with a traceback

Traceback (most recent call last):
  File "C:\Users\UK03306\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\UK03306\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Work\Scratch\rc\lib\site-packages\rich\color.py", line 480, in <module>
    console.save_html("color.html", inline_styles=True)
  File "C:\Work\Scratch\rc\lib\site-packages\rich\console.py", line 903, in save_html
    write_file.write(html)
  File "C:\Users\UK03306\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 238-313: character maps to <undefined>

So I guess there's some encoding issues to address. And it may be that the Windows terminal doesn't even support rich colours (I thought recent versions did at least, but I've no real idea how to check 🙁)

The main thing for me is that you're using colorama, so you have a reasonable expectation of things being cross-platform - but without access to a Windows system it's only ever going to be "try it and see, and PRs gratefully accepted". Which is totally reasonable. (Also rich.color is a nice way of doing a quick test).

I'm not sure I'll have time in the near future to offer any patches - I mostly looked at the library from curiosity (I saw a reference on Planet Python). But if I have a project at any point where I'd actually use the library, I'll see if I can help with Windows for you.

from rich.

willmcgugan avatar willmcgugan commented on May 22, 2024

I don't have a Windows box here and I haven't got Windows CI set up yet. Until then I can't be certain it works in Windows.

It should. Try installing and running python -m rich.color if its not too much of an inconvenience for you.

from rich.

pfmoore avatar pfmoore commented on May 22, 2024

Looks like colorama doesn't support 24-bit colour on Windows. The terminal itself does.

from rich.

willmcgugan avatar willmcgugan commented on May 22, 2024

Well that's promising at least. I suspect with the encoding issues fixed I can get it working in some fashion.

If colorama can't do 24-bit I can downgrade to 256 colors (already implemented), or I could attempt to support Windows codes natively.

I'm probably going to focus on fixes and features in the short term, but I will dig out a Windows laptop at some point.

from rich.

pfmoore avatar pfmoore commented on May 22, 2024

Thanks for the feedback - no pressure, I may be the only one interested in this, and as I say I don't have a project for it right now, so don't feel obliged on my account :-) I appreciate your time responding here.

from rich.

willmcgugan avatar willmcgugan commented on May 22, 2024

v0.3.3 has fixes for Windows.

Seems solid enough, but it is restricted to what Colorama supports. No italic / bold and only 8 colors (16 if you include bold which is rendered as bright).

from rich.

Kirill avatar Kirill commented on May 22, 2024

Windows PowerShell 7.0.1 look like this screen
ss_20200605_132958_2

from rich.

willmcgugan avatar willmcgugan commented on May 22, 2024

Yeah, there's been some changes for the new Windows terminal, which is on par with OSX / Linux now. Old cmd works, with reduced colors.

from rich.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.