Skip to content

Commit 795cbbf

Browse files
committed
improved command display code
1 parent 5e3b769 commit 795cbbf

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

components/retroui/CommandDisplay.tsx

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,18 @@ export function CommandDisplay({ command }: CommandDisplayProps) {
2020
}
2121
};
2222

23+
const defaultColors = [
24+
"text-blue-300",
25+
"text-yellow-300",
26+
"text-green-300",
27+
"text-purple-300",
28+
];
29+
2330
// Split the command into parts for syntax highlighting
2431
const parts = command.split(" ").map((part, index) => {
25-
if (index === 0)
26-
return (
27-
<span key={index} className="text-blue-300">
28-
{part}
29-
</span>
30-
);
31-
if (index === 1)
32-
return (
33-
<span key={index} className="text-yellow-300">
34-
{part}
35-
</span>
36-
);
37-
if (index === 2)
38-
return (
39-
<span key={index} className="text-green-300">
40-
{part}
41-
</span>
42-
);
32+
const color = defaultColors[index % defaultColors.length];
4333
return (
44-
<span key={index} className="text-purple-300">
34+
<span key={index} className={color}>
4535
{part}
4636
</span>
4737
);

0 commit comments

Comments
 (0)