(
{ score, text }: { score: number; text?: string },
style: Ansis = ansis,
)
| 289 | |
| 290 | // @TODO rethink implementation |
| 291 | export function applyScoreColor( |
| 292 | { score, text }: { score: number; text?: string }, |
| 293 | style: Ansis = ansis, |
| 294 | ) { |
| 295 | const formattedScore = text ?? formatReportScore(score); |
| 296 | |
| 297 | if (score >= SCORE_COLOR_RANGE.GREEN_MIN) { |
| 298 | return text |
| 299 | ? style.green(formattedScore) |
| 300 | : style.bold(style.green(formattedScore)); |
| 301 | } |
| 302 | |
| 303 | if (score >= SCORE_COLOR_RANGE.YELLOW_MIN) { |
| 304 | return text |
| 305 | ? style.yellow(formattedScore) |
| 306 | : style.bold(style.yellow(formattedScore)); |
| 307 | } |
| 308 | |
| 309 | return text |
| 310 | ? style.red(formattedScore) |
| 311 | : style.bold(style.red(formattedScore)); |
| 312 | } |
| 313 | |
| 314 | export function scoreTargetIcon( |
| 315 | score: number, |
no test coverage detected