Comments (11)
you can't. But you can use pastel paint
to print colored text with a proper reset sequence.
from pastel.
pastel paint
is fine for generating single lines of colored text. That becomes quite unreadable for longer text like help messages where you would have to split each line into the colored part with pastel paint --no-newline
and the rest.
Generating the escape codes via pastel format
works fine: I get all the colors I need except the "reset color". Would you consider adding it?
from pastel.
Generating the escape codes via
pastel format
works fine: I get all the colors I need except the "reset color". Would you consider adding it?
How do you think the command-line interface for this should look like?
from pastel.
Using "reset", "normal" or "nocolor" as special identifier (similar to "pick") would do the job in my opinion.
Use case:
declare -A color
for color in yellow reset; do
color[$color]=$(pastel format ansi-24bit-escapecode $color)
done
echo -e "${color[yellow]}[WARN]${color[reset]}: a warning event occurred"
from pastel.
As a side note: ANSI defines a lot of "colors" which are rather text effects like blink, bold or underline. "Reset" in that regard is special in my opinion as you need it constantly to "turn off color" and switch back to "normal".
from pastel.
I'm not 100% convinced. It's inconsistent that pastel format ansi-24bit-escapecode reset
works, but pastel format rgb reset
does not. pastel color yellow
works, but pastel color reset
makes no sense.
What is the problem with simply setting
reset=$(printf "\x1b[0m")
or
reset=$(tput sgr0)
from pastel.
Of course there is no problem simply setting reset to the respective escape sequence. On the other hand, why should I use pastel
to set the color yellow when I simply can do yellow='\e[33m'
? What's the use case of format ansi-24bit-escapecode
if not so you don't have to know all those weird escape codes?
Anyway, please feel free to close this issue.
from pastel.
I mean... pastel format ansi-24bit-escapecode yellow
is not the most interesting use case.
The general idea of pastel
is that you generate/compute colors in a pastel … | pastel … | …
"pipeline" and then in the end convert it to a desired output format (here: an ANSI escape sequence).
I think I'm inclined to accept this feature request. But I would like us to think about different ways to achieve that goal.
By the way, I think pastel format ansi-24bit-escapecode
should have a way to handle multiple colors. Right now, if you do something like
pastel gradient -n 10 red yellow | pastel format ansi-24bit-escapecode
it just outputs those 10 escape sequences one after each other without any way to split them. Because we do not print a newline for ansi-*-escapesequence
. Which is useful if there is just a single color. But not if you want to work with multiple escape codes somehow (e.g. via xargs
).
from pastel.
ive looked at this issue, but for me, format ansi-24bit-escapecode doesnt seem to work very well: it prints absolutely nothing?
from pastel.
ive looked at this issue, but for me, format ansi-24bit-escapecode doesnt seem to work very well: it prints absolutely nothing?
Yes it does. It prints actual ansi escape sequences (which are not visible in interactive mode). Either print add some text after them. Or pipe into a hexeditor for "debugging" purposes.
from pastel.
I'm closing this due to inactivity. Please feel free to comment in case it should be re-opened.
from pastel.
Related Issues (20)
- Most similar colors option HOT 1
- fzf preview window does not show colors from pastel's output HOT 5
- Colorpicker options HOT 2
- Rotate in La*b* space HOT 1
- `pick` error HOT 4
- How to create background colors with `pastel format`? HOT 1
- Can this Generate a Sequence of Color Shade strings? HOT 3
- Performance issue with the redundancy operations HOT 1
- [pastel error]: Could not find any external color picker tool HOT 2
- Picking directly from terminal HOT 2
- It would be great to be able to paint gradients in TMUX and Powerline directly with pastel HOT 1
- Feature request: Short name for some commands HOT 1
- The bars doesn't show colors HOT 1
- colorcheck not in commands list ? HOT 3
- `pastel pick` does not work and suggests unhelpful advice. HOT 1
- missing dependencies HOT 2
- Add support for setting alpha values / `transparent` color HOT 1
- how to force colour output with a pager ? HOT 2
- Invert/negate color? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pastel.