mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Give Gemini Code a face lift.
- This utilizes `ink-gradient` to render GEMINI CODE in amazing colors. - Added a shared color configuration for UX (should this be in config?). It's very possible that we shouldn't be talking about the specific colors and instead be mentioning "foreground"/"background"/inlineCode etc. type colors. - Updated existing color usages to utilize `Colors.*` Fixes https://b.corp.google.com/issues/411385593
This commit is contained in:
committed by
N. Taylor Mullen
parent
3fce6cea27
commit
f7edf71190
@@ -23,6 +23,7 @@
|
||||
"dotenv": "^16.4.7",
|
||||
"fast-glob": "^3.3.3",
|
||||
"ink": "^5.2.0",
|
||||
"ink-gradient": "^3.0.0",
|
||||
"ink-select-input": "^6.0.0",
|
||||
"ink-spinner": "^5.0.0",
|
||||
"ink-text-input": "^6.0.0",
|
||||
|
||||
@@ -11,7 +11,6 @@ import { useGeminiStream } from './hooks/useGeminiStream.js';
|
||||
import { useLoadingIndicator } from './hooks/useLoadingIndicator.js';
|
||||
import { useInputHistory } from './hooks/useInputHistory.js';
|
||||
import { Header } from './components/Header.js';
|
||||
import { Tips } from './components/Tips.js';
|
||||
import { HistoryDisplay } from './components/HistoryDisplay.js';
|
||||
import { LoadingIndicator } from './components/LoadingIndicator.js';
|
||||
import { InputPrompt } from './components/InputPrompt.js';
|
||||
@@ -22,7 +21,8 @@ import {
|
||||
useStartupWarnings,
|
||||
useInitializationErrorEffect,
|
||||
} from './hooks/useAppEffects.js';
|
||||
import type { Config } from '@gemini-code/server';
|
||||
import { shortenPath, type Config } from '@gemini-code/server';
|
||||
import { Colors } from './colors.js';
|
||||
|
||||
interface AppProps {
|
||||
config: Config;
|
||||
@@ -73,39 +73,37 @@ export const App = ({ config }: AppProps) => {
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" padding={1} marginBottom={1} width="100%">
|
||||
<Header cwd={config.getTargetDir()} />
|
||||
<Header />
|
||||
|
||||
{startupWarnings.length > 0 && (
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor="yellow"
|
||||
borderColor={Colors.AccentYellow}
|
||||
paddingX={1}
|
||||
marginY={1}
|
||||
flexDirection="column"
|
||||
>
|
||||
{startupWarnings.map((warning, index) => (
|
||||
<Text key={index} color="yellow">
|
||||
<Text key={index} color={Colors.AccentYellow}>
|
||||
{warning}
|
||||
</Text>
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
|
||||
<Tips />
|
||||
|
||||
{initError &&
|
||||
streamingState !== StreamingState.Responding &&
|
||||
!isWaitingForToolConfirmation && (
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor="red"
|
||||
borderColor={Colors.AccentRed}
|
||||
paddingX={1}
|
||||
marginBottom={1}
|
||||
>
|
||||
{history.find(
|
||||
(item) => item.type === 'error' && item.text?.includes(initError),
|
||||
)?.text ? (
|
||||
<Text color="red">
|
||||
<Text color={Colors.AccentRed}>
|
||||
{
|
||||
history.find(
|
||||
(item) =>
|
||||
@@ -115,8 +113,10 @@ export const App = ({ config }: AppProps) => {
|
||||
</Text>
|
||||
) : (
|
||||
<>
|
||||
<Text color="red">Initialization Error: {initError}</Text>
|
||||
<Text color="red">
|
||||
<Text color={Colors.AccentRed}>
|
||||
Initialization Error: {initError}
|
||||
</Text>
|
||||
<Text color={Colors.AccentRed}>
|
||||
{' '}
|
||||
Please check API key and configuration.
|
||||
</Text>
|
||||
@@ -134,7 +134,18 @@ export const App = ({ config }: AppProps) => {
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{isInputActive && <InputPrompt onSubmit={handleHistorySubmit} />}
|
||||
{isInputActive && (
|
||||
<>
|
||||
<Box>
|
||||
<Text color={Colors.SubtleComment}>cwd: </Text>
|
||||
<Text color={Colors.LightBlue}>
|
||||
{shortenPath(config.getTargetDir(), /*maxLength*/ 70)}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
<InputPrompt onSubmit={handleHistorySubmit} />
|
||||
</>
|
||||
)}
|
||||
|
||||
<Footer queryLength={query.length} />
|
||||
<ITermDetectionWarning />
|
||||
|
||||
12
packages/cli/src/ui/colors.ts
Normal file
12
packages/cli/src/ui/colors.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export const Colors = {
|
||||
Background: '#1E1E2E',
|
||||
Foreground: 'white',
|
||||
LightBlue: '#CDD6F4',
|
||||
AccentBlue: '#89B4FA',
|
||||
AccentPurple: '#CBA6F7',
|
||||
AccentCyan: '#89DCEB',
|
||||
AccentGreen: '#A6E3A1',
|
||||
AccentYellow: '#F9E2AF',
|
||||
AccentRed: '#F38BA8',
|
||||
SubtleComment: '#6C7086',
|
||||
};
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
interface FooterProps {
|
||||
queryLength: number;
|
||||
@@ -14,8 +15,10 @@ interface FooterProps {
|
||||
export const Footer: React.FC<FooterProps> = ({ queryLength }) => (
|
||||
<Box marginTop={1} justifyContent="space-between">
|
||||
<Box minWidth={15}>
|
||||
<Text color="gray">{queryLength === 0 ? '? for shortcuts' : ''}</Text>
|
||||
<Text color={Colors.SubtleComment}>
|
||||
{queryLength === 0 ? '? for shortcuts' : ''}
|
||||
</Text>
|
||||
</Box>
|
||||
<Text color="blue">Gemini</Text>
|
||||
<Text color={Colors.AccentBlue}>Gemini</Text>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -6,37 +6,32 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { UI_WIDTH, BOX_PADDING_X } from '../constants.js';
|
||||
import { shortenPath } from '@gemini-code/server';
|
||||
import Gradient from 'ink-gradient';
|
||||
import { Tips } from './Tips.js';
|
||||
|
||||
interface HeaderProps {
|
||||
cwd: string;
|
||||
}
|
||||
const gradientColors = ['#4796E4', '#847ACE', '#C3677F'];
|
||||
|
||||
export const Header: React.FC<HeaderProps> = ({ cwd }) => (
|
||||
export const Header: React.FC = () => (
|
||||
<>
|
||||
{/* Static Header Art */}
|
||||
<Box marginBottom={1}>
|
||||
<Text color="blue">{`
|
||||
______ ________ ____ ____ _____ ____ _____ _____
|
||||
.' ___ ||_ __ ||_ \\ / _||_ _||_ \\|_ _||_ _|
|
||||
/ .' \\_| | |_ \\_| | \\/ | | | | \\ | | | |
|
||||
| | ____ | _| _ | |\\ /| | | | | |\\ \\| | | |
|
||||
\\ \`.___] |_| |__/ | _| |_\\/_| |_ _| |_ _| |_\\ |_ _| |_
|
||||
\`._____.'|________||_____||_____||_____||_____|\\____||_____|`}</Text>
|
||||
</Box>
|
||||
{/* CWD Display */}
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor="blue"
|
||||
paddingX={BOX_PADDING_X}
|
||||
flexDirection="column"
|
||||
marginBottom={1}
|
||||
width={UI_WIDTH}
|
||||
>
|
||||
<Box paddingLeft={2}>
|
||||
<Text color="gray">cwd: {shortenPath(cwd, /*maxLength*/ 70)}</Text>
|
||||
</Box>
|
||||
<Box marginBottom={1} alignItems="flex-start">
|
||||
<Gradient colors={gradientColors}>
|
||||
<Text>{`
|
||||
██████╗ ███████╗███╗ ███╗██╗███╗ ██╗██╗
|
||||
██╔════╝ ██╔════╝████╗ ████║██║████╗ ██║██║
|
||||
██║ ███╗█████╗ ██╔████╔██║██║██╔██╗ ██║██║
|
||||
██║ ██║██╔══╝ ██║╚██╔╝██║██║██║╚██╗██║██║
|
||||
╚██████╔╝███████╗██║ ╚═╝ ██║██║██║ ╚████║██║
|
||||
╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝
|
||||
|
||||
██████╗ ██████╗ ██████╗ ███████╗
|
||||
██╔════╝██╔═══██╗██╔══██╗██╔════╝
|
||||
██║ ██║ ██║██║ ██║█████╗
|
||||
██║ ██║ ██║██║ ██║██╔══╝
|
||||
╚██████╗╚██████╔╝██████╔╝███████╗
|
||||
╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝
|
||||
`}</Text>
|
||||
</Gradient>
|
||||
</Box>
|
||||
<Tips />
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Box, useInput, useFocus } from 'ink';
|
||||
import { Text, Box, useInput, useFocus } from 'ink';
|
||||
import TextInput from 'ink-text-input';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
interface InputPromptProps {
|
||||
onSubmit: (value: string) => void;
|
||||
@@ -29,19 +30,18 @@ export const InputPrompt: React.FC<InputPromptProps> = ({ onSubmit }) => {
|
||||
);
|
||||
|
||||
return (
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor={isFocused ? 'blue' : 'gray'}
|
||||
paddingX={1}
|
||||
>
|
||||
<TextInput
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
placeholder="Enter your message or use tools..."
|
||||
onSubmit={() => {
|
||||
/* Empty to prevent double submission */
|
||||
}}
|
||||
/>
|
||||
<Box borderStyle="round" borderColor={Colors.AccentBlue} paddingX={1}>
|
||||
<Text color={Colors.AccentPurple}>> </Text>
|
||||
<Box flexGrow={1}>
|
||||
<TextInput
|
||||
value={value}
|
||||
onChange={setValue}
|
||||
placeholder="Enter your message or use tools..."
|
||||
onSubmit={() => {
|
||||
/* Empty to prevent double submission */
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import Spinner from 'ink-spinner';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
interface LoadingIndicatorProps {
|
||||
isLoading: boolean;
|
||||
@@ -28,11 +29,11 @@ export const LoadingIndicator: React.FC<LoadingIndicatorProps> = ({
|
||||
<Box marginRight={1}>
|
||||
<Spinner type="dots" />
|
||||
</Box>
|
||||
<Text color="cyan">
|
||||
<Text color={Colors.AccentPurple}>
|
||||
{currentLoadingPhrase} ({elapsedTime}s)
|
||||
</Text>
|
||||
<Box flexGrow={1}>{/* Spacer */}</Box>
|
||||
<Text color="gray">(ESC to cancel)</Text>
|
||||
<Text color={Colors.SubtleComment}>(ESC to cancel)</Text>
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -6,19 +6,28 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { UI_WIDTH } from '../constants.js';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
export const Tips: React.FC = () => (
|
||||
<Box flexDirection="column" marginBottom={1} width={UI_WIDTH}>
|
||||
<Text>Tips for getting started:</Text>
|
||||
<Text>
|
||||
1. <Text bold>/help</Text> for more information.
|
||||
<Box flexDirection="column" marginBottom={1}>
|
||||
<Text color={Colors.Foreground}>Tips for getting started:</Text>
|
||||
<Text color={Colors.Foreground}>
|
||||
1.{' '}
|
||||
<Text bold color={Colors.AccentPurple}>
|
||||
/help
|
||||
</Text>{' '}
|
||||
for more information.
|
||||
</Text>
|
||||
<Text>
|
||||
2. <Text bold>/init</Text> to create a GEMINI.md for instructions &
|
||||
context.
|
||||
<Text color={Colors.Foreground}>
|
||||
2.{' '}
|
||||
<Text bold color={Colors.AccentPurple}>
|
||||
/init
|
||||
</Text>{' '}
|
||||
to create a GEMINI.md for instructions & context.
|
||||
</Text>
|
||||
<Text>3. Ask coding questions, edit code or run commands.</Text>
|
||||
<Text>4. Be specific for the best results.</Text>
|
||||
<Text color={Colors.Foreground}>
|
||||
3. Ask coding questions, edit code or run commands.
|
||||
</Text>
|
||||
<Text color={Colors.Foreground}>4. Be specific for the best results.</Text>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Box, Text } from 'ink';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface DiffLine {
|
||||
type: 'add' | 'del' | 'context' | 'hunk' | 'other';
|
||||
@@ -96,7 +97,7 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
tabWidth = DEFAULT_TAB_WIDTH,
|
||||
}) => {
|
||||
if (!diffContent || typeof diffContent !== 'string') {
|
||||
return <Text color="yellow">No diff content.</Text>;
|
||||
return <Text color={Colors.AccentYellow}>No diff content.</Text>;
|
||||
}
|
||||
|
||||
const parsedLines = parseDiffWithLineNumbers(diffContent);
|
||||
@@ -114,7 +115,7 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
|
||||
if (displayableLines.length === 0) {
|
||||
return (
|
||||
<Box borderStyle="round" borderColor="gray" padding={1}>
|
||||
<Box borderStyle="round" borderColor={Colors.SubtleComment} padding={1}>
|
||||
<Text dimColor>No changes detected.</Text>
|
||||
</Box>
|
||||
);
|
||||
@@ -137,7 +138,11 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
// --- End Modification ---
|
||||
|
||||
return (
|
||||
<Box borderStyle="round" borderColor="gray" flexDirection="column">
|
||||
<Box
|
||||
borderStyle="round"
|
||||
borderColor={Colors.SubtleComment}
|
||||
flexDirection="column"
|
||||
>
|
||||
{/* Iterate over the lines that should be displayed (already normalized) */}
|
||||
{displayableLines.map((line, index) => {
|
||||
const key = `diff-line-${index}`;
|
||||
@@ -165,7 +170,6 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown line type: ${line.type}`);
|
||||
break;
|
||||
}
|
||||
|
||||
// Render the line content *after* stripping the calculated *minimum* baseIndentation.
|
||||
@@ -175,7 +179,7 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({
|
||||
return (
|
||||
// Using your original rendering structure
|
||||
<Box key={key} flexDirection="row">
|
||||
<Text color="gray">{gutterNumStr} </Text>
|
||||
<Text color={Colors.SubtleComment}>{gutterNumStr} </Text>
|
||||
<Text color={color} dimColor={dim}>
|
||||
{prefixSymbol}{' '}
|
||||
</Text>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Text, Box } from 'ink';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface ErrorMessageProps {
|
||||
text: string;
|
||||
@@ -18,10 +19,10 @@ export const ErrorMessage: React.FC<ErrorMessageProps> = ({ text }) => {
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
<Box width={prefixWidth}>
|
||||
<Text color="red">{prefix}</Text>
|
||||
<Text color={Colors.AccentRed}>{prefix}</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1}>
|
||||
<Text wrap="wrap" color="red">
|
||||
<Text wrap="wrap" color={Colors.AccentRed}>
|
||||
{text}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import React from 'react';
|
||||
import { Text, Box } from 'ink';
|
||||
import { MarkdownRenderer } from '../../utils/MarkdownRenderer.js';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface GeminiMessageProps {
|
||||
text: string;
|
||||
@@ -28,7 +29,7 @@ export const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => {
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
<Box width={prefixWidth}>
|
||||
<Text color="blue">{prefix}</Text>
|
||||
<Text color={Colors.AccentPurple}>{prefix}</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1}></Box>
|
||||
</Box>
|
||||
@@ -38,7 +39,7 @@ export const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => {
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
<Box width={prefixWidth}>
|
||||
<Text color="blue">{prefix}</Text>
|
||||
<Text color={Colors.AccentPurple}>{prefix}</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1} flexDirection="column">
|
||||
{renderedBlocks}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Text, Box } from 'ink';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface InfoMessageProps {
|
||||
text: string;
|
||||
@@ -18,10 +19,10 @@ export const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => {
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
<Box width={prefixWidth}>
|
||||
<Text color="yellow">{prefix}</Text>
|
||||
<Text color={Colors.AccentYellow}>{prefix}</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1}>
|
||||
<Text wrap="wrap" color="yellow">
|
||||
<Text wrap="wrap" color={Colors.AccentYellow}>
|
||||
{text}
|
||||
</Text>
|
||||
</Box>
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import { DiffRenderer } from './DiffRenderer.js';
|
||||
import { UI_WIDTH } from '../../constants.js';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
export interface ToolConfirmationMessageProps {
|
||||
confirmationDetails: ToolCallConfirmationDetails;
|
||||
@@ -74,7 +75,9 @@ export const ToolConfirmationMessage: React.FC<
|
||||
confirmationDetails as ToolExecuteConfirmationDetails;
|
||||
|
||||
// For execution, we still need context display and description
|
||||
const commandDisplay = <Text color="cyan">{executionProps.command}</Text>;
|
||||
const commandDisplay = (
|
||||
<Text color={Colors.AccentCyan}>{executionProps.command}</Text>
|
||||
);
|
||||
|
||||
// Combine command and description into bodyContent for layout consistency
|
||||
bodyContent = (
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js';
|
||||
import { ToolMessage } from './ToolMessage.js';
|
||||
import { PartListUnion } from '@google/genai';
|
||||
import { ToolConfirmationMessage } from './ToolConfirmationMessage.js';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface ToolGroupMessageProps {
|
||||
toolCalls: IndividualToolCallDisplay[];
|
||||
@@ -22,7 +23,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
onSubmit,
|
||||
}) => {
|
||||
const hasPending = toolCalls.some((t) => t.status === ToolCallStatus.Pending);
|
||||
const borderColor = hasPending ? 'yellow' : 'blue';
|
||||
const borderColor = hasPending ? Colors.AccentYellow : Colors.AccentBlue;
|
||||
|
||||
return (
|
||||
<Box flexDirection="column" borderStyle="round" borderColor={borderColor}>
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
} from '../../types.js';
|
||||
import { DiffRenderer } from './DiffRenderer.js';
|
||||
import { FileDiff, ToolResultDisplay } from '../../../tools/tools.js';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
export const ToolMessage: React.FC<IndividualToolCallDisplay> = ({
|
||||
callId,
|
||||
@@ -31,7 +32,7 @@ export const ToolMessage: React.FC<IndividualToolCallDisplay> = ({
|
||||
| undefined;
|
||||
const typedResultDisplay = resultDisplay as ToolResultDisplay | undefined;
|
||||
|
||||
let color = 'gray';
|
||||
let color = Colors.SubtleComment;
|
||||
let prefix = '';
|
||||
switch (status) {
|
||||
case ToolCallStatus.Pending:
|
||||
@@ -41,15 +42,15 @@ export const ToolMessage: React.FC<IndividualToolCallDisplay> = ({
|
||||
prefix = 'Executing:';
|
||||
break;
|
||||
case ToolCallStatus.Confirming:
|
||||
color = 'yellow';
|
||||
color = Colors.AccentYellow;
|
||||
prefix = 'Confirm:';
|
||||
break;
|
||||
case ToolCallStatus.Success:
|
||||
color = 'green';
|
||||
color = Colors.AccentGreen;
|
||||
prefix = 'Success:';
|
||||
break;
|
||||
case ToolCallStatus.Error:
|
||||
color = 'red';
|
||||
color = Colors.AccentRed;
|
||||
prefix = 'Error:';
|
||||
break;
|
||||
default:
|
||||
@@ -60,11 +61,11 @@ export const ToolMessage: React.FC<IndividualToolCallDisplay> = ({
|
||||
const title = `${prefix} ${name}`;
|
||||
|
||||
return (
|
||||
<Box key={callId} borderStyle="round" paddingX={1} flexDirection="column">
|
||||
<Box key={callId} flexDirection="column" paddingX={1}>
|
||||
<Box>
|
||||
{status === ToolCallStatus.Invoked && (
|
||||
<Box marginRight={1}>
|
||||
<Text color="blue">
|
||||
<Text color={Colors.AccentBlue}>
|
||||
<Spinner type="dots" />
|
||||
</Text>
|
||||
</Box>
|
||||
@@ -91,7 +92,7 @@ export const ToolMessage: React.FC<IndividualToolCallDisplay> = ({
|
||||
)}
|
||||
{/* Display command for execute */}
|
||||
{'command' in typedConfirmationDetails && (
|
||||
<Text color="yellow">
|
||||
<Text color={Colors.AccentYellow}>
|
||||
Command:{' '}
|
||||
{
|
||||
(typedConfirmationDetails as ToolExecuteConfirmationDetails)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Text, Box } from 'ink';
|
||||
import { Colors } from '../../colors.js';
|
||||
|
||||
interface UserMessageProps {
|
||||
text: string;
|
||||
@@ -18,7 +19,7 @@ export const UserMessage: React.FC<UserMessageProps> = ({ text }) => {
|
||||
return (
|
||||
<Box flexDirection="row">
|
||||
<Box width={prefixWidth}>
|
||||
<Text color="gray">{prefix}</Text>
|
||||
<Text color={Colors.SubtleComment}>{prefix}</Text>
|
||||
</Box>
|
||||
<Box flexGrow={1}>
|
||||
<Text wrap="wrap">{text}</Text>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Text, Box } from 'ink';
|
||||
import { Colors } from '../colors.js';
|
||||
|
||||
/**
|
||||
* A utility class to render a subset of Markdown into Ink components.
|
||||
@@ -83,14 +84,14 @@ export class MarkdownRenderer {
|
||||
const codeMatch = fullMatch.match(/^(`+)(.+?)\1$/s);
|
||||
if (codeMatch && codeMatch[2]) {
|
||||
renderedNode = (
|
||||
<Text key={key} color="yellow">
|
||||
<Text key={key} color={Colors.AccentPurple}>
|
||||
{codeMatch[2]}
|
||||
</Text>
|
||||
);
|
||||
} else {
|
||||
// Fallback for simple or non-matching cases
|
||||
renderedNode = (
|
||||
<Text key={key} color="yellow">
|
||||
<Text key={key} color={Colors.AccentPurple}>
|
||||
{fullMatch.slice(1, -1)}
|
||||
</Text>
|
||||
);
|
||||
@@ -109,7 +110,7 @@ export class MarkdownRenderer {
|
||||
renderedNode = (
|
||||
<Text key={key}>
|
||||
{linkText}
|
||||
<Text color="blue"> ({url})</Text>
|
||||
<Text color={Colors.AccentBlue}> ({url})</Text>
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -160,7 +161,7 @@ export class MarkdownRenderer {
|
||||
key={key}
|
||||
borderStyle="round"
|
||||
paddingX={1}
|
||||
borderColor="gray"
|
||||
borderColor={Colors.SubtleComment}
|
||||
flexDirection="column"
|
||||
>
|
||||
{lang && <Text dimColor> {lang}</Text>}
|
||||
@@ -281,14 +282,14 @@ export class MarkdownRenderer {
|
||||
switch (level /* ... (header styling as before) ... */) {
|
||||
case 1:
|
||||
headerNode = (
|
||||
<Text bold color="cyan">
|
||||
<Text bold color={Colors.AccentCyan}>
|
||||
{renderedHeaderText}
|
||||
</Text>
|
||||
);
|
||||
break;
|
||||
case 2:
|
||||
headerNode = (
|
||||
<Text bold color="blue">
|
||||
<Text bold color={Colors.AccentBlue}>
|
||||
{renderedHeaderText}
|
||||
</Text>
|
||||
);
|
||||
@@ -298,7 +299,7 @@ export class MarkdownRenderer {
|
||||
break;
|
||||
case 4:
|
||||
headerNode = (
|
||||
<Text italic color="gray">
|
||||
<Text italic color={Colors.SubtleComment}>
|
||||
{renderedHeaderText}
|
||||
</Text>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user