I see a nicely colored output in my terminal.
The terminal has a "Export Text As" command but it saves a plain-text file without the colors. Same with copy&paste.
Do you know a way to save terminal output including colors?
I see a nicely colored output in my terminal.
The terminal has a "Export Text As" command but it saves a plain-text file without the colors. Same with copy&paste.
Do you know a way to save terminal output including colors?
Amazing how posting a question boosts ones creativity.
I can open "Print" dialog and save to PDF and then copy colored output from the PDF.
Also iTerm2 terminal app has a shortcut CMDOPTC that copies with formatting.
It appears that if you select text in the Terminal, then copy it, then paste it into an application that supports rich text (e.g. Mail, TextEdit, Word), then the text color will be preserved.
It appears that in Mail and TextEdit, the background color of the terminal is also pasted; in Word, it is not. I'm not sure how to explain this discrepancy.
you can try to paste the colored output to the clipboard like this:
% command_which_produces_colors | pbcopy -prefer rtf
which puts some rtf (possibly colored and formated) stuff into the pasteboard of macos. you can then use any other that understands richtext to access the clipboard.
this is obviously not the same as "select it with the mouse" but maybe worth a shot.
Based on @akira's answer, I came up with the following:
brew install ansifilter)<command that produces colors> | ansifilter --rtf | pbcopy -Prefer rtf
<command that produces colors> to force it to produce colors even though its output is piped, e.g. ls --color=always instead of just lsIn iTerm2 you can go to Edit → Copy with Control Sequences to copy with the ANSI colour codes.
Then you just need something that will render ANSI colours.
OS X has several keyboard shortcuts (hotkeys) for copying the screen. These will save your screenshots as a jpg files on the desktop. Here's a list of them:
Cmd-Shift-3 Take snapshot of the whole screen
Cmd-Shift-4 Take snapshot of the selected area
Cmd-Shift-4-Spacebar Take picture of a window
Escape Cancel
Hold Spacebar after Drawing the region Move the selected area
Hold Option Resize selected area
Hold Shift Resize selected area horizontally
or vertically
There's also a "Grab" application located in the Applications | Utilities folder that does the same job, plus has a few extra features such as delay.
Update
In Snow Leopard (10.6.8) the default screenshot format is png not jpg, although that can be changed to any one of many others -- including pdf -- using the free 3rd-party TinkerTool preference settings utility.
The way I do this is via the excellent Textmate 2 app.
I have to say it would nice if shift-cmd-c worked directly in the R console window.