Skip to content

Commit

Permalink
Find ANSI colour codes that work across most (all?) terminals
Browse files Browse the repository at this point in the history
Signed-off-by: Phil Ewels <[email protected]>
  • Loading branch information
ewels committed Feb 12, 2024
1 parent 00c22b1 commit 13e631c
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,17 @@ class CmdRun extends CmdBase implements HubOptions {
// Fancy coloured header for the ANSI console output
def fmt = ansi()
fmt.a("\n")
// Use exact Nextflow green RGB (13, 192, 157) and exact black text (0,0,0)
// Should render the same on every terminal, irrespective of colour scheme
// Jansi library can't do RGBs, so just do the ANSI codes manually
fmt.a("\033[1;38;2;0;0;0;48;2;13;192;157m N E X T F L O W ").reset()
// Use exact colour codes so that they render the same on every terminal,
// irrespective of terminal colour scheme.
// Nextflow green RGB (13, 192, 157) and exact black text (0,0,0),
// Apple Terminal only supports 256 colours, so use the closest match:
// light sea green | #20B2AA | 38;5;0
// Don't use black for text as terminals mess with this in their colour schemes.
// Use very dark grey, which is more reliable.
// Jansi library bundled in Jline can't do exact RGBs,
// so just do the ANSI codes manually
fmt.a("\033[1m\033[38;5;232m\033[48;5;43m N E X T F L O W ").reset()

// Show Nextflow version
fmt.a(Attribute.INTENSITY_FAINT).a(" ~ ").reset().a("version " + BuildInfo.version).reset()
fmt.a("\n")
Expand Down

0 comments on commit 13e631c

Please sign in to comment.