mirror of
https://github.com/tiennm99/ccstatusline.git
synced 2026-07-19 00:18:39 +00:00
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import type { RenderContext } from '../types/RenderContext';
|
|
import type { Settings } from '../types/Settings';
|
|
import type {
|
|
Widget,
|
|
WidgetEditorDisplay,
|
|
WidgetItem
|
|
} from '../types/Widget';
|
|
|
|
export class OutputStyleWidget implements Widget {
|
|
getDefaultColor(): string { return 'cyan'; }
|
|
getDescription(): string { return 'Shows the current Claude Code output style'; }
|
|
getDisplayName(): string { return 'Output Style'; }
|
|
getEditorDisplay(item: WidgetItem): WidgetEditorDisplay {
|
|
return { displayText: this.getDisplayName() };
|
|
}
|
|
|
|
render(item: WidgetItem, context: RenderContext, settings: Settings): string | null {
|
|
if (context.isPreview) {
|
|
return item.rawValue ? 'default' : 'Style: default';
|
|
} else if (context.data?.output_style?.name) {
|
|
return item.rawValue ? context.data.output_style.name : `Style: ${context.data.output_style.name}`;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
supportsRawValue(): boolean { return true; }
|
|
supportsColors(item: WidgetItem): boolean { return true; }
|
|
} |