Skip to content

Latest commit

Β 

History

History
44 lines (31 loc) Β· 2.75 KB

TriceColor.md

File metadata and controls

44 lines (31 loc) Β· 2.75 KB

Trice Tags and Color

Trice is usable without tags and color similar to printf also.

1. How to get

  • Add a tag name as color descriptor in front of each TRICE format string like "wrn:Peng!".
  • In file ../internal/emitter/lineTransformerANSI.go the colors are changeable and additional color tags definable.
  • It is possible to concatenate single colorized letters to get output like this:

./ref/COLOR_output.PNG

  • ../_test/testdata/triceCheck.c contains the code for this example.
  • The trice tool, if knowing wrn: as pattern, prepends the appropriate color code. It removes the sequence wrn:, if it is known and completely lower case.
  • The user can define any pattern with any color code to create colored output with the trice tool.
  • There is no tag enable switch inside the target code. It would need a back channel and add overhead.
    • An option using tag specific ID range assignment exists. See closed issue #243.
  • The trice tool offers the 2 command line switches -pick and -ban to control tag visualization during runtime.

1.1. Output options

./ref/ColorOptions.PNG

1.2. Check Alternatives

There are over 1000 possibilities:

./ref/ColorAlternatives.PNG

Only file ../internal/emitter/lineTransformerANSI.go needs to be changed and the trice tool needs to be rebuild afterwards: go install ./....

2. Color issues under Windows

Currently console colors are not enabled by default in Win10, so if you see no color but escape sequences on your powershell or cmd window, please refer to Windows console with ANSI colors handling or simply use a Linux like terminal under windows, like git-bash. One option is also to install Microsoft Windows Terminal (Preview) from inside the Microsoft store and to start the trice tool inside there. Unfortunately this can not be done automatically right now because of missing command line switches. Alacritty is one of other alternatives.