Add ANSI color codes to your Tiltfile log messages.
Works with Tiltfile built-ins such as print, warn, fail, exit in addition to custom functions.
load('ext://color', 'color')
print(color.red('ERROR: ') + 'Something went wrong')
print('The {earth} is about 71% {water}.'.format(
earth=color.green('earth'),
water=color.blue('water')
))All color functions take a single argument (the string to be colorized) and return a string.
Available color functions:
color.blackcolor.redcolor.greencolor.yellowcolor.bluecolor.magentacolor.cyancolor.white
To disable colors from this extension, set the NO_COLOR environment variable, e.g. NO_COLOR=1 tilt up.
Additionally, unless forcibly enabled, when running tilt ci, if running on Windows or TERM=dumb, colors will be automatically disabled to prevent compatibility issues.
NOTE: Colors are automatically enabled when running tilt up regardless of OS/terminal support, as the Tilt web UI always supports color ANSI codes.
You can force colors from this extension by setting the FORCE_COLOR environment variable, e.g. FORCE_COLOR=1 tilt up.
(If both NO_COLOR and FORCE_COLOR are set, NO_COLOR will take precedence.)