by austin-cheney · 1y ago · 0 comments
text: {
angry : "\u001b[1m\u001b[31m",
blue : "\u001b[34m",
bold : "\u001b[1m",
boldLine : "\u001b[1m\u001b[4m",
clear : "\u001b[24m\u001b[22m",
cyan : "\u001b[36m",
green : "\u001b[32m",
noColor : "\u001b[39m",
none : "\u001b[0m",
purple : "\u001b[35m",
red : "\u001b[31m",
underline: "\u001b[4m",
yellow : "\u001b[33m"
}
And then you can call that directly like: `${vars.text.green}whatever${vars.text.none}`;Using a library which handles that (an a thousand other quirks) makes much more sense
The real issue is invented here syndrome. People irrationally defer to libraries to cure their emotional fear of uncertainty. For really large problems, like complete terminal emulation, I understand that. However, when taken to an extreme, like the left pad debacle, it’s clear people are loading up on dependencies for irrational reasons.
It's easy to solve though, simply assign empty strings to escape code variables when the output is not an interactive shell.
Also, I'm guessing if I pipe your logs to a file you'll still write escapes into it? Why not just make life easier?
cjk→⋰⋱| | ← cjk space btw | |
thinsp | |
deg°
⋯ …
‾⎻⎼⎽ lines
_ light lines
⏤ wide lines
↕
∧∨
┌────┬────┐
│ │ ⋱ ⎸ ← left bar, right bar: ⎹
└────┴────┘
⊃⊂ ⊐≣⊏
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯====›‥‥‥‥
◁ ◿ ◺ ◻ ◸
Λ
╱│╲
╱ │ ╲
──┼──
╲ │ ╱
╲│╱
V
┌ ─┏━━┳━━━━━━━┓
│ ┃ ┃ ┃
├ ─┣━━╋━━━━━━━┫
│ ┃ ┃ ┃
└ ─┗━━┻━━━━━━━┛
┌ ─ ┬ ─ ┐
├ ─ ┼ ─ ┤
└ ─ ┴ ─ ┘
┌───┬───┐
├───┼───┤
│ │ │
└───┴───┘
.
╱│╲
↘╱ │ ╲ ↙
╱ │ ╲
→‹───┼───›←
╲ │ ╱
↗ ╲ │ ╱ ↖
╲│╱
↓↑
╳
.
╱ ╲
╱ ╲
╱ ⋰ ╲
╱⋰______╲