| @clack/prompts | minor |
|---|
Add theme support for the text prompt. Users can now customize the colors of symbols, guide lines, and error messages by passing a theme option.
Example usage:
import { text } from '@clack/prompts';
import color from 'picocolors';
const result = await text({
message: 'Enter your name',
theme: {
formatSymbolActive: (str) => color.magenta(str),
formatGuide: (str) => color.blue(str),
formatErrorMessage: (str) => color.bgRed(color.white(str)),
}
});Available theme options for text prompt:
formatSymbolActive- Format the prompt symbol in active/initial stateformatSymbolSubmit- Format the prompt symbol on submitformatSymbolCancel- Format the prompt symbol on cancelformatSymbolError- Format the prompt symbol on errorformatErrorMessage- Format error messagesformatGuide- Format the left guide line in active stateformatGuideSubmit- Format the guide line on submitformatGuideCancel- Format the guide line on cancelformatGuideError- Format the guide line on error
This establishes the foundation for theming support that will be extended to other prompts.