Skip to content

Commit

Permalink
theme core
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jan 27, 2024
1 parent c548e14 commit e346907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions packages/core/src/lib/theme.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import chalk from 'chalk';
import spinners from 'cli-spinners';
import type { Prettify } from '@inquirer/type';

export type DefaultTheme = {
type DefaultTheme = {
prefix: string;
spinner: {
interval: number;
Expand All @@ -23,13 +23,16 @@ export type Theme<Extension extends {} = {}> = Prettify<Extension & DefaultTheme

export const defaultTheme: DefaultTheme = {
prefix: chalk.green('?'),
spinner: spinners.dots,
spinner: {
interval: spinners.dots.interval,
frames: spinners.dots.frames.map(chalk.yellow),
},
style: {
answer: chalk.cyan,
message: chalk.bold,
error: (text) => chalk.red(`> ${text}`),
defaultAnswer: (text) => chalk.dim(`(${text})`),
help: (text) => chalk.dim(text),
help: chalk.dim,
highlight: chalk.cyan,
key: (text: string) => chalk.cyan.bold(`<${text}>`),
},
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/lib/use-prefix.mts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import chalk from 'chalk';
import { useState } from './use-state.mjs';
import { useEffect } from './use-effect.mjs';
import { makeTheme } from './make-theme.mjs';
Expand Down Expand Up @@ -26,7 +25,7 @@ export function usePrefix({

if (isLoading) {
const frame = tick % spinner.frames.length;
return chalk.yellow(spinner.frames[frame]);
return spinner.frames[frame]!;
}

return prefix;
Expand Down

0 comments on commit e346907

Please sign in to comment.