- 
                Notifications
    You must be signed in to change notification settings 
- Fork 150
          refactor: replaces picocolors with node:util's styleText
          #346
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 🦋 Changeset detectedLatest commit: 1569bc4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
 Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR | 
picocolors with node:util's styleText
      picocolors with node:util's styleTextpicocolors with node:util's styleText
      | @example/basic • @example/changesets commit:  | 
| const prefix = isItem ? (selectableGroups ? `${isLast ? S_BAR_END : S_BAR} ` : ' ') : ''; | ||
| const spacingPrefix = | ||
| groupSpacing > 0 && !isItem ? `\n${color.cyan(S_BAR)} `.repeat(groupSpacing) : ''; | ||
| // groupSpacing > 0 && !isItem ? `\n${color.cyan(S_BAR)} `.repeat(groupSpacing) : ''; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this left over? and should be removed
| .join('\n'); | ||
| output.write( | ||
| `${color.gray(S_BAR)}\n${color.green(S_STEP_SUBMIT)} ${color.reset(title)} ${color.gray( | ||
| `${styleText('gray', S_BAR)}\n${styleText('green', S_STEP_SUBMIT)} ${styleText('reset', title || '')} ${styleText( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when is title nullish? i.e. why did we end up with ||?
| output: opts.output, | ||
| render() { | ||
| const title = `${color.gray(S_BAR)}\n${symbol(this.state)} ${opts.message}\n`; | ||
| // const title = `${color.gray(S_BAR)}\n${symbol(this.state)} ${opts.message}\n`; | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe remove this comment too?
| _message = removeTrailingDots(msg); | ||
| _origin = performance.now(); | ||
| output.write(`${color.gray(S_BAR)}\n`); | ||
| // output.write(`${color.gray(S_BAR)}\n`); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another comment we can probably remove
| [36m│[39m [2m○[22m [2mGrape[22m | ||
| [36m│[39m [2m○[22m [2mOrange[22m | ||
| [36m│[39m [2m[2m↑/↓[22m[2m to select • [2mEnter:[22m[2m confirm • [2mType:[22m[2m to search[22m | ||
| [36m│[39m [2m[2m↑/↓[22m to select • [2mEnter:[22m confirm • [2mType:[22m to search[22m | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this shows that styleText doesn't handle nested colours. e.g.:
styleText(`i am dim ${styleText('bold', 'i am bold')} i am no longer dim`);we should search our code for any nested styles and double check they actually work
| no worries for sure lets hold off until nesting lands 👍 | 
| console.clear(); | ||
|  | ||
| p.intro(`${color.bgCyan(color.black(' Integrated Autocomplete Multiselect Example '))}`); | ||
| p.intro(`${styleText('bgCyan', styleText('black', ' Integrated Autocomplete Multiselect Example '))}`); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi styleText supports an array for cases like this
| p.intro(`${styleText('bgCyan', styleText('black', ' Integrated Autocomplete Multiselect Example '))}`); | |
| p.intro(styleText(['bgCyan', 'black'], ' Integrated Autocomplete Multiselect Example ')); | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you 😁
| Closing this in favor of #403. | 
Closes: #338