Skip to content

@types/node: Permit passing hex color in array argument of styleText utility - #75656

Merged
typescript-automation[bot] merged 4 commits into
DefinitelyTyped:masterfrom
delucis:delucis/node-styletext-args
Oct 9, 2026
Merged

typescript-automation[bot] merged 4 commits into
DefinitelyTyped:masterfrom
delucis:delucis/node-styletext-args

Conversation

@delucis

@delucis delucis commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Types for hex color strings were added in #75153 (v26) and #75574 (v24), but only in the non-array form, e.g. styleText("#f00", "red text"). Node also supports passing hex colors inside an array to combine with other modifiers, e.g. styleText(["#f00", "bold"], "bold red text"). This PR updates the types, docs, and tests to reflect that support for both Node v24 and v26.

Please fill in this template.

Select one of these and delete the others:

If changing an existing definition:

@typescript-automation

typescript-automation Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

@delucis Thank you for submitting this PR!

This is a live comment that I will keep updated.

1 package in this PR

Code Reviews

Because this is a widely-used package, a DT maintainer will need to review it before it can be merged.

You can test the changes of this PR in the Playground.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Most recent commit is approved by a DT maintainer

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 75656,
  "author": "delucis",
  "headCommitOid": "365fa6c8a7ba82abfdc3f0d83d86d6318166b31b",
  "mergeBaseOid": "ac3977d854a671215b8d3e2d5e4ced9c345bf00b",
  "lastPushDate": "2026-10-03T10:12:54.000Z",
  "lastActivityDate": "2026-10-09T18:24:08.000Z",
  "mergeOfferDate": "2026-10-09T18:16:12.000Z",
  "mergeRequestDate": "2026-10-09T18:24:08.000Z",
  "mergeRequestUser": "delucis",
  "hasMergeConflict": false,
  "isFirstContribution": false,
  "tooManyFiles": false,
  "hugeChange": false,
  "tooManyCommits": false,
  "tooManyReviews": false,
  "popularityLevel": "Critical",
  "pkgInfo": [
    {
      "name": "node",
      "version": "26.6",
      "kind": "edit",
      "files": [
        {
          "path": "types/node/node-tests/util.ts",
          "kind": "test"
        },
        {
          "path": "types/node/util.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/node/v24/test/util.ts",
          "kind": "test"
        },
        {
          "path": "types/node/v24/util.d.ts",
          "kind": "definition"
        }
      ],
      "owners": [
        "Microsoft",
        "jkomyno",
        "r3nya",
        "btoueg",
        "touffy",
        "mohsen1",
        "galkin",
        "eps1lon",
        "WilcoBakker",
        "trivikr",
        "yoursunny",
        "ExE-Boss",
        "peterblazejewicz",
        "addaleax",
        "NodeJS",
        "LinusU",
        "wafuwafu13",
        "mcollina",
        "Semigradsky",
        "Renegade334",
        "anonrig"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Critical"
    }
  ],
  "reviews": [
    {
      "type": "approved",
      "reviewer": "johnfav03",
      "date": "2026-10-09T18:15:32.000Z",
      "isMaintainer": true
    },
    {
      "type": "approved",
      "reviewer": "Renegade334",
      "date": "2026-10-04T20:01:10.000Z",
      "isMaintainer": false
    },
    {
      "type": "approved",
      "reviewer": "anonrig",
      "date": "2026-10-03T17:05:22.000Z",
      "isMaintainer": false
    }
  ],
  "mainBotCommentID": 5968153026,
  "ciResult": "pass"
}

@typescript-automation

Copy link
Copy Markdown
Contributor

🔔 @microsoft @jkomyno @r3nya @btoueg @Touffy @mohsen1 @galkin @eps1lon @WilcoBakker @trivikr @yoursunny @ExE-Boss @peterblazejewicz @addaleax @nodejs @LinusU @wafuwafu13 @mcollina @Semigradsky @Renegade334 @anonrig — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-automation typescript-automation Bot added the Owner Approved A listed owner of this package signed off on the pull request. label Oct 3, 2026
Comment thread types/node/util.d.ts
* The full list of formats can be found in [modifiers](https://nodejs.org/docs/latest-v26.x/api/util.html#modifiers).
* @param format A text format or an Array of text formats defined in `util.inspect.colors`, or a hex color in `#RGB`
* or `#RRGGBB` form.
* @param format A text format defined in `util.inspect.colors`, a hex color in `#RGB` or `#RRGGBB` form,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any changes to docblocks will be overwritten from source at some point, if you want this to be reflected in the documentation then please open a PR at nodejs/node.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer! I opened nodejs/node#66539 to do this — hopefully I got it right, it’s my first time contributing to the Node repo.

@typescript-automation typescript-automation Bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Oct 9, 2026
@typescript-automation

Copy link
Copy Markdown
Contributor

@delucis: Everything looks good here. I am ready to merge this PR (at 365fa6c) on your behalf whenever you think it's ready.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@microsoft, @jkomyno, @r3nya, @btoueg, @Touffy, @mohsen1, @galkin, @eps1lon, @WilcoBakker, @trivikr, @yoursunny, @ExE-Boss, @peterblazejewicz, @addaleax, @nodejs, @LinusU, @wafuwafu13, @mcollina, @Semigradsky, @Renegade334, @anonrig: you can do this too.)

@typescript-automation typescript-automation Bot moved this from Needs Maintainer Review to Waiting for Author to Merge in Pull Request Status Board Oct 9, 2026
@delucis

delucis commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Ready to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Critical package Maintainer Approved Owner Approved A listed owner of this package signed off on the pull request. Self Merge This PR can now be self-merged by the PR author or an owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants