Skip to content

feat: add support for Chalk color functions in prefix colors#578

Merged
gustavohenke merged 2 commits intoopen-cli-tools:mainfrom
stephanschubert:feat/chalk-color-functions
Apr 18, 2026
Merged

feat: add support for Chalk color functions in prefix colors#578
gustavohenke merged 2 commits intoopen-cli-tools:mainfrom
stephanschubert:feat/chalk-color-functions

Conversation

@stephanschubert
Copy link
Copy Markdown
Contributor

Summary

  • Add support for all Chalk color functions: hex(), bgHex(), rgb(), bgRgb(), ansi256(), bgAnsi256()
  • Add shorthand syntax #RRGGBB (foreground) and bg#RRGGBB (background)
  • Support chaining functions and modifiers (e.g., rgb(255,136,0).bold, black.bgHex(#00FF00).dim)
  • Fix CLI parsing to correctly handle commas inside function calls like rgb(255,255,0)

Examples

# Hex colors
$ concurrently -c 'bg#FF0000.bold,black.bgHex(#00FF00).dim' 'echo Red bg' 'echo Green bg'

# RGB colors
$ concurrently -c 'rgb(255,136,0).bold,black.bgRgb(100,100,255)' 'echo Orange' 'echo Blue bg'

# ANSI 256 colors
$ concurrently -c 'ansi256(199),ansi256(50).bgAnsi256(17)' 'echo Pink' 'echo Cyan on blue'

@coveralls
Copy link
Copy Markdown

coveralls commented Dec 14, 2025

Coverage Status

coverage: 100.0%. remained the same — stephanschubert:feat/chalk-color-functions into open-cli-tools:main

@stephanschubert stephanschubert force-pushed the feat/chalk-color-functions branch from 60300e8 to d74c6a0 Compare December 14, 2025 14:48
@stephanschubert
Copy link
Copy Markdown
Contributor Author

Updated coverage:

 % Coverage report from v8
---------------------------|---------|----------|---------|---------|-------------------
File                       | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
---------------------------|---------|----------|---------|---------|-------------------
All files                  |     100 |    99.83 |     100 |     100 |
 lib                       |     100 |    99.75 |     100 |     100 |
  assert.ts                |     100 |      100 |     100 |     100 |
  command.ts               |     100 |      100 |     100 |     100 |
  completion-listener.ts   |     100 |      100 |     100 |     100 |
  concurrently.ts          |     100 |      100 |     100 |     100 |
  date-format.ts           |     100 |    98.98 |     100 |     100 | 281
  defaults.ts              |     100 |      100 |     100 |     100 |
  jsonc.ts                 |     100 |      100 |     100 |     100 |
  logger.ts                |     100 |      100 |     100 |     100 |
  observables.ts           |     100 |      100 |     100 |     100 |
  output-writer.ts         |     100 |      100 |     100 |     100 |
  prefix-color-selector.ts |     100 |      100 |     100 |     100 |
  spawn.ts                 |     100 |      100 |     100 |     100 |
  utils.ts                 |     100 |      100 |     100 |     100 |
 lib/__fixtures__          |     100 |      100 |     100 |     100 |
  create-mock-instance.ts  |     100 |      100 |     100 |     100 |
  fake-command.ts          |     100 |      100 |     100 |     100 |
 lib/command-parser        |     100 |      100 |     100 |     100 |
  expand-arguments.ts      |     100 |      100 |     100 |     100 |
  expand-shortcut.ts       |     100 |      100 |     100 |     100 |
  expand-wildcard.ts       |     100 |      100 |     100 |     100 |
  strip-quotes.ts          |     100 |      100 |     100 |     100 |
 lib/flow-control          |     100 |      100 |     100 |     100 |
  input-handler.ts         |     100 |      100 |     100 |     100 |
  kill-on-signal.ts        |     100 |      100 |     100 |     100 |
  kill-others.ts           |     100 |      100 |     100 |     100 |
  log-error.ts             |     100 |      100 |     100 |     100 |
  log-exit.ts              |     100 |      100 |     100 |     100 |
  log-output.ts            |     100 |      100 |     100 |     100 |
  log-timings.ts           |     100 |      100 |     100 |     100 |
  logger-padding.ts        |     100 |      100 |     100 |     100 |
  output-error-handler.ts  |     100 |      100 |     100 |     100 |
  restart-process.ts       |     100 |      100 |     100 |     100 |
  teardown.ts              |     100 |      100 |     100 |     100 |
---------------------------|---------|----------|---------|---------|-------------------

Copy link
Copy Markdown
Member

@gustavohenke gustavohenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa this looks like a powerful improvement to prefix colouring!
Can you rebase your PR, please?

Comment thread bin/index.ts Outdated
Add support for all Chalk color functions: hex(), bgHex(), rgb(), bgRgb(),
ansi256(), bgAnsi256(), plus shorthand syntax #RRGGBB and bg#RRGGBB.

Functions and modifiers can be chained (e.g., rgb(255,136,0).bold,
black.bgHex(#00FF00).dim).

The CLI now correctly parses color arguments containing commas inside
function calls like rgb(255,255,0) by using a parenthesis-aware splitter.
The CLI's comma-splitter for color args and the logger's dot-splitter for
color path segments shared near-identical paren-aware string walking. Extract
the shared logic into lib/utils.ts, parameterized on the delimiter, and wire
up both call sites.
@stephanschubert stephanschubert force-pushed the feat/chalk-color-functions branch from d74c6a0 to dafbc3e Compare April 17, 2026 13:49
Copy link
Copy Markdown
Member

@gustavohenke gustavohenke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment thread lib/logger.spec.ts
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome coverage

@gustavohenke gustavohenke merged commit 74dffcd into open-cli-tools:main Apr 18, 2026
31 of 32 checks passed
@stephanschubert stephanschubert deleted the feat/chalk-color-functions branch April 18, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants