GithubHelp home page GithubHelp logo

Comments (6)

felixfbecker avatar felixfbecker commented on September 26, 2024

Frankly I don't know what those escape sequences mean, I just use https://github.com/chalk/chalk

from cli-highlight.

christopherreay avatar christopherreay commented on September 26, 2024

so, the issue is that when "your code" is returning to "default text", there are two ways of doing it

^[39m is "white"
^[0m is "default"

I suppose you have asked chalk to "go to white". I tried to have a look myself, but i couldnt see where the logic for the code was. I can have a look if you like, if you can point me in roughly the right direction

You can imagine, without ever "going to default", some tools are creating extremely nested output

from cli-highlight.

felixfbecker avatar felixfbecker commented on September 26, 2024

The nodes are wrapped in escape sequences here:

return ((theme as any)[token] || (DEFAULT_THEME as any)[token] || plain)(nodeData)

with the default theme being defined here:
export const DEFAULT_THEME: Theme = {

from cli-highlight.

christopherreay avatar christopherreay commented on September 26, 2024

ok, Ill have a look.

At the moment im processing the output with sed to do the same.

Thanks :)

Christopher

from cli-highlight.

sindresorhus avatar sindresorhus commented on September 26, 2024

^[39m is "white"

This is not correct. That code escape closes/resets a foreground color.

See: https://github.com/chalk/ansi-styles/blob/de7527a86c1cf49906b0eb32a0de1402d849ccc2/index.js#L34-L51

from cli-highlight.

christopherreay avatar christopherreay commented on September 26, 2024

ok, so I spoke to chalk, they explained what [39m and [0m mean:

[39m means "reset the foreground color to default"
[0m means "reset everything to default"

So they reckon that it is the script I am using that is bugged, not the output of cli-highlight that should be changed :)

Cheers :)

from cli-highlight.

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.