Skip to content

Commit

Permalink
Consistent Nextflow Greens
Browse files Browse the repository at this point in the history
  • Loading branch information
ewels committed Mar 27, 2024
1 parent 1a705c5 commit 7fc0f95
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/content/blog/2024/nextflow-colored-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ The console output shown by Nextflow describes a range of information. Much of i

With some judicious use of the `dim` style, we can make less important information fade into the background. For example, the "stem" of the fully qualified process identifiers now step back to allow the process name to stand out. Secondary information such as the number of tasks that were cached, or the executor that is being submitted to, are still there to see but take a back seat. Doing the reverse with some `bold` text helps to highlight the run name – key information for identifying and resuming pipeline runs. Using color allows different fields to be easily distinguished, such as process labels and task hashes. Greens, blues, and reds in the task statuses allow a reader to get an impression of the run progress without needing to read every number.

Probably the most difficult aspect technically was the `NEXTFLOW` header line. I knew I wanted to use the "Nextflow Green" here, or as close to it as possible. But colors in the terminal are tricky. What the ANSI standard defines as `green`, `black`, and `blue` can vary significantly across different systems and terminal themes. Some people use a light color scheme and others run in dark mode. This hadn’t mattered much for most of the colors up until this point - I could use the [Jansi](https://github.com/fusesource/jansi) library to use named colors and they should look ok. But for the specific RGB of the _"Nextflow Green"_ I had to [hardcode specific ANSI control characters](https://github.com/nextflow-io/nextflow/blob/c9c7032c2e34132cf721ffabfea09d893adf3761/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy#L379-L389). But it got worse - it turns out that the default Terminal app that ships with macOS only supports 256 colors, so I had to find the closest match (_"light sea green"_ if you’re curious). Even once the green was ok, using `black` as the text color meant that it would actually render as white with some terminal color themes and be unreadable. In the end, the header text is a very dark gray.
Probably the most difficult aspect technically was the `NEXTFLOW` header line. I knew I wanted to use the _"Nextflow Green"_ here, or as close to it as possible. But colors in the terminal are tricky. What the ANSI standard defines as `green`, `black`, and `blue` can vary significantly across different systems and terminal themes. Some people use a light color scheme and others run in dark mode. This hadn’t mattered much for most of the colors up until this point - I could use the [Jansi](https://github.com/fusesource/jansi) library to use named colors and they should look ok. But for the specific RGB of the _"Nextflow Green"_ I had to [hardcode specific ANSI control characters](https://github.com/nextflow-io/nextflow/blob/c9c7032c2e34132cf721ffabfea09d893adf3761/modules/nextflow/src/main/groovy/nextflow/cli/CmdRun.groovy#L379-L389). But it got worse - it turns out that the default Terminal app that ships with macOS only supports 256 colors, so I had to find the closest match (_"light sea green"_ if you’re curious). Even once the green was ok, using `black` as the text color meant that it would actually render as white with some terminal color themes and be unreadable. In the end, the header text is a very dark gray.

<figure>
<img src="/img/blog-nextflow-colored-logs/testing_terminal_themes.png" alt="Testing many horrible terminal themes">
Expand Down

0 comments on commit 7fc0f95

Please sign in to comment.