sapling/eden/scm/tests/test-color-escapes.t
Mark Juggurnauth-Thomas 0ef99947cc color: add combined effects in fallback chains
Summary:
Allow color effects to be joined with `+`, e.g. `blue+bold`.  Unlike effects
separated by spaces, these effects must all be available in order for the
effect to apply.  If any of the effects are not available, then the combined
effect is not valid.

This is useful in fallback chains, where some of the fallbacks are combined
effects, for example: `brightred:red+bold`.

Use these to improve the fallback chains for sparse profiles, so that the
profile names are not shown in black on 8 color terminals.

Reviewed By: quark-zju

Differential Revision: D26580365

fbshipit-source-id: 8e204c901566ac03fb4af066ab1a09142750a9fb
2021-02-23 04:47:01 -08:00

43 lines
1.5 KiB
Perl

#chg-compatible
$ setconfig ui.color=always color.mode=ansi
$ setconfig color.color.none=0
$ setconfig alias.testcolor="debugtemplate '{label(\"test.test\", \"output\n\")}'"
$ hg testcolor --config color.test.test=blue
\x1b[0;34moutput\x1b[0m (esc)
$ hg testcolor --config color.test.test="blue bold"
\x1b[0;34;1moutput\x1b[0m (esc)
$ hg testcolor --config color.test.test="brightblue"
\x1b[0;94moutput\x1b[0m (esc)
$ hg testcolor --config color.test.test="blue+bold"
\x1b[0;34;1moutput\x1b[0m (esc)
$ hg testcolor --config color.test.test="brightblue:blue+bold"
\x1b[0;94moutput\x1b[0m (esc)
$ HGCOLORS=8 hg testcolor --config color.test.test="brightblue:blue+bold"
\x1b[0;34;1moutput\x1b[0m (esc)
$ hg testcolor --config color.test.test="brightblue:blue+bold underline"
\x1b[0;94;4moutput\x1b[0m (esc)
$ HGCOLORS=8 hg testcolor --config color.test.test="brightblue:blue+bold underline"
\x1b[0;34;1;4moutput\x1b[0m (esc)
$ HGCOLORS=16777216 hg testcolor --config color.test.test="#359:color68+italic:brightblue:blue+bold underline"
\x1b[0;38;2;51;85;153;4moutput\x1b[0m (esc)
$ HGCOLORS=256 hg testcolor --config color.test.test="#359:color68+italic:brightblue:blue+bold underline"
\x1b[0;38;5;68;3;4moutput\x1b[0m (esc)
$ HGCOLORS=16 hg testcolor --config color.test.test="#359:color68+italic:brightblue:blue+bold underline"
\x1b[0;94;4moutput\x1b[0m (esc)
$ HGCOLORS=8 hg testcolor --config color.test.test="#359:color68+italic:brightblue:blue+bold underline"
\x1b[0;34;1;4moutput\x1b[0m (esc)