continue-custom/extensions/cli/src/ui/components/ToolPreview.tsx
continue[bot] 977442ac18
Fix gray text readability on light backgrounds in CLI (#7898)
Replace hard-to-read gray text with 'dim' color which is more readable
on both light and dark terminal backgrounds. This primarily affects:

- Startup display: MCP prompt descriptions, model loading text, tips
- Message rendering: user input, system messages, streaming indicators
- Tool displays: result summaries, previews, diff output
- Status displays: action status, timers, loading text

The 'dim' color provides better contrast than 'gray' on light backgrounds
while remaining subtle and unobtrusive on dark backgrounds.

Generated with [Continue](https://continue.dev)

Co-authored-by: Continue Agent <agent@continue.dev>
Co-authored-by: Continue <noreply@continue.dev>
2025-09-22 13:20:22 -07:00

63 lines
1.7 KiB
TypeScript

import { Box, Text } from "ink";
import React from "react";
import { getToolDisplayName } from "../../tools/index.js";
import { ToolCallPreview } from "../../tools/types.js";
import { ColoredDiff } from "../ColoredDiff.js";
import { ChecklistDisplay } from "./ChecklistDisplay.js";
interface ToolPreviewProps {
toolCallPreview?: ToolCallPreview[];
toolName: string;
toolArgs: any;
}
/**
* Generates a preview of what a tool will do based on its arguments
*/
export const ToolPreview: React.FC<ToolPreviewProps> = ({
toolCallPreview,
toolName,
toolArgs,
}) => {
if (toolCallPreview) {
return (
<Box display={"flex"} flexDirection="column" marginTop={1}>
{toolCallPreview.map((preview, index) => {
if (preview.type === "text") {
return (
<Box key={index} paddingLeft={preview.paddingLeft ?? 0}>
{index === 0 && <Text color="dim">⎿ </Text>}
<Text color={preview.color ?? "dim"}>{preview.content}</Text>
</Box>
);
} else if (preview.type === "checklist") {
return (
<Box key={index}>
<ChecklistDisplay
content={`Task list status:\n${preview.content}`}
/>
</Box>
);
} else {
return <ColoredDiff key={index} diffContent={preview.content} />;
}
})}
</Box>
);
}
let message = `Will call ${getToolDisplayName(toolName)}`;
const argCount = Object.keys(toolArgs || {}).length;
if (argCount > 0) {
message += ` with ${argCount} argument${argCount === 1 ? "" : "s"}`;
}
return (
<Box>
<Text color="dim">⎿ </Text>
<Text color="dim">{message}</Text>
</Box>
);
};