| 183 | } |
| 184 | |
| 185 | function segmentToStyle(style: AnsiStyle): React.CSSProperties { |
| 186 | return { |
| 187 | color: style.color, |
| 188 | backgroundColor: style.background, |
| 189 | fontWeight: style.bold ? "bold" : undefined, |
| 190 | opacity: style.dim ? 0.7 : undefined, |
| 191 | fontStyle: style.italic ? "italic" : undefined, |
| 192 | textDecoration: [ |
| 193 | style.underline ? "underline" : "", |
| 194 | style.strikethrough ? "line-through" : "", |
| 195 | ] |
| 196 | .filter(Boolean) |
| 197 | .join(" ") || undefined, |
| 198 | }; |
| 199 | } |
| 200 | |
| 201 | interface AnsiRendererProps { |
| 202 | text: string; |