Giter Club home page Giter Club logo

Comments (9)

ofek avatar ofek commented on June 8, 2024

Can you please tell me what happens when you change the background color here? https://github.com/pypa/hatch/blob/hatch-v1.10.0/src/hatch/cli/config/__init__.py#L36

from hatch.

bluss avatar bluss commented on June 8, 2024

Using "white"

        text = app.config_file.read() if all_keys else app.config_file.read_scrubbed()
        app.output(Syntax(text.rstrip(), 'toml', background_color='white'))

produces

bild

Using '#ffffff'

        text = app.config_file.read() if all_keys else app.config_file.read_scrubbed()
        app.output(Syntax(text.rstrip(), 'toml', background_color='#ffffff'))

produces

bild

Using None

        app.output(Syntax(text.rstrip(), 'toml', background_color=None))

produces

bild

That's readable. Not pretty, but the contrast works, so it's readable. 🙂

from hatch.

ofek avatar ofek commented on June 8, 2024

@willmcgugan What should I do here? I'm not sure what is recommended.

from hatch.

willmcgugan avatar willmcgugan commented on June 8, 2024

Syntax will use an Pygments theme by default. Pygments themes use RGB colors , which means that changing the background without changing the text colors is unlikely to look good.

You can also use ansi colors, which will render with the user's choice of terminal theme colors. Just set theme="ansi_light" or theme="ansi_dark".

from hatch.

bluss avatar bluss commented on June 8, 2024

I would suggest to keep it simple, because programs like gcc, rustc, ls, rg etc output colorful text without trying to know which background color the terminal has.

Pick a syntax coloring with few classes (few different colors or styles) and use ansi colors, I guess?

from hatch.

ofek avatar ofek commented on June 8, 2024

I'm just going to remove the explicit background color for broader compatibility even though on light terminals it might not be as pretty like you mentioned. If you require configurability (and can provide example keyword arguments that look good) feel free to open a separate feature request!

from hatch.

ofek avatar ofek commented on June 8, 2024

Just as a heads up (mostly for Will) the background_color option must be set to default for tests because otherwise a bunch of spaces get written at the end of each line I think based on the terminal size. That may be in fact why I did that originally 😅

from hatch.

bluss avatar bluss commented on June 8, 2024

Ok, thanks for that. What do you think about a config option that turns off syntax highlight for this?

from hatch.

ofek avatar ofek commented on June 8, 2024

Sure I can do that.

from hatch.

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.