log.io icon indicating copy to clipboard operation
log.io copied to clipboard

ASCII color support

Open ngoctnq opened this issue 4 years ago • 6 comments

Currently I'm piping a program's output into a text file and then let log.io track it. However, it gives [0M-type of characters in the stream and not format them (like it would have if I were using less -r). Is the support for this functionality?

ngoctnq avatar Mar 10 '20 12:03 ngoctnq

This is not currently supported... I'll add this as a feature request. I'm not too familiar with all ASCII color escape codes, would implementing support for the following table be sufficient? https://en.wikipedia.org/wiki/ANSI_escape_code#Colors

msmathers avatar Mar 10 '20 13:03 msmathers

I'd say that's sufficient. If we go with stuff like screen clearing, that'll open a huge can of worm.

ngoctnq avatar Mar 10 '20 13:03 ngoctnq

I'm also interested in coloring the output

sik0vny avatar May 10 '20 02:05 sik0vny

Use : https://github.com/nteract/ansi-to-react in ScreenMessage

const ScreenMessage: React.FC<ScreenMessageProps> = ({ message, messageFilter }) => { return (

{messageFilter && _parseMessageParts(message, messageFilter).map((part, i) => <span key={i} className={part.highlight ? 'highlight' : ''}>
<Ansi> {part.text} </Ansi> )} {!messageFilter && <Ansi>{message}</Ansi>}
) }

see : https://github.com/s3pweb/log.io/blob/master/ui/src/components/screens/index.tsx

sguilly avatar May 28 '20 15:05 sguilly

@sguilly you should make this a pull request. Any instructions on how to use your changes? I got the main code working, but don't know how to add your edits. My experience is limited with node/npm.

imidoriya avatar Oct 19 '20 01:10 imidoriya

Use : https://github.com/nteract/ansi-to-react in ScreenMessage

const ScreenMessage: React.FC = ({ message, messageFilter }) => { return (

{messageFilter && _parseMessageParts(message, messageFilter).map((part, i) => <span key={i} className={part.highlight ? 'highlight' : ''}>

{part.text}

)} {!messageFilter && {message}}

) } see : https://github.com/s3pweb/log.io/blob/master/ui/src/components/screens/index.tsx

It looks good! Please pull a request.

yunnysunny avatar Jan 01 '21 08:01 yunnysunny