Skip to content

Commit

Permalink
fix(cli): multiple fontStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Oct 28, 2024
1 parent e26920a commit c9acd17
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/cli/src/code-to-ansi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ export async function codeToANSI(code: string, lang: BundledLanguage, theme: Bun
const color = token.color || themeReg.fg
if (color)
text = c.hex(hexApplyAlpha(color, themeReg.type))(text)
if (token.fontStyle === FontStyle.Bold)
text = c.bold(text)
if (token.fontStyle === FontStyle.Italic)
text = c.italic(text)
if (token.fontStyle) {
if (token.fontStyle & FontStyle.Bold)
text = c.bold(text)
if (token.fontStyle & FontStyle.Italic)
text = c.italic(text)
if (token.fontStyle & FontStyle.Underline)
text = c.underline(text)
}
output += text
}
output += '\n'
Expand Down

0 comments on commit c9acd17

Please sign in to comment.