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

add colour syntax highlighting (quick hack) #32

Closed
wants to merge 1 commit into from

Conversation

elliots
Copy link

@elliots elliots commented Oct 3, 2019

I don't think you want to just merge this (it adds a bunch of dependencies, and you could do separately), but im adding just in case youre interested. (cc: #27 )

@atombender
Copy link
Member

Thanks, I like it! I'm not sure the extra dependencies are a problem. @simen?

@elliots
Copy link
Author

elliots commented Oct 3, 2019

This is the colour scheme i picked (the one in the example of the library I used, but there are many)

image

The background colour is a little annoying.

@wolfogre
Copy link

Any progress? 😃

Comment on lines +432 to +440
func DumpColor(value ...interface{}) {
result := (&Config).Sdump(value...)
if err := quick.Highlight(os.Stdout, result, "go", "terminal256", "monokai"); err != nil {
os.Stdout.Write([]byte("[syntax highlight error: " + err.Error() + "]"))
}
}

// Dump a value to stdout in colour
func DumpColour(value ...interface{}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This two function names are kind of confusing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two spellings of colour/color, depending on where in the world you are. (I'm in Australia, we have a "u").

@icholy
Copy link
Contributor

icholy commented Dec 17, 2020

I am very opposed to adding this large dependency for something that:

  • Can easily be done outside of the package.
  • Doesn't have a clear use-case.

@atombender
Copy link
Member

@icholy Yes, I agree. We could make a new module, though, e.g. github.com/sanity-io/litter/colorized.

@atombender atombender closed this Dec 17, 2020
@seyedmmousavi
Copy link

seyedmmousavi commented Jun 10, 2024

I am very opposed to adding this large dependency for something that:

  • Can easily be done outside of the package.

How can you do it outside the package and yet keep it really useful?

  • Doesn't have a clear use-case.

It simply makes it easy and fast to read. A huge UX improvement
The color can be used to make some virtual levels. For example, the address and value types have lower priority and can be gray. Values can be colored based on type and so on.

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

Successfully merging this pull request may close these issues.

None yet

6 participants