Skip to content

Commit 98136c1

Browse files
committed
Add /theme:toggle command
1 parent 83a14dd commit 98136c1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

cli/src/commands/command-registry.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import open from 'open'
22

33
import { handleAdsEnable, handleAdsDisable } from './ads'
4+
import { useThemeStore } from '../hooks/use-theme'
45
import { handleHelpCommand } from './help'
56
import { handleImageCommand } from './image'
67
import { handleInitializationFlowLocally } from './init'
@@ -513,6 +514,20 @@ export const COMMAND_REGISTRY: CommandDefinition[] = [
513514
return { openReviewScreen: true }
514515
},
515516
}),
517+
defineCommand({
518+
name: 'theme:toggle',
519+
handler: (params) => {
520+
const { theme, setThemeName } = useThemeStore.getState()
521+
const newTheme = theme.name === 'dark' ? 'light' : 'dark'
522+
setThemeName(newTheme)
523+
params.setMessages((prev) => [
524+
...prev,
525+
getUserMessage(params.inputValue.trim()),
526+
getSystemMessage(`Switched to ${newTheme} theme.`),
527+
])
528+
clearInput(params)
529+
},
530+
}),
516531
]
517532

518533
export function findCommand(cmd: string): CommandDefinition | undefined {

cli/src/data/slash-commands.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ export const SLASH_COMMANDS: SlashCommand[] = [
137137
label: 'publish',
138138
description: 'Publish agents to the agent store',
139139
},
140+
{
141+
id: 'theme:toggle',
142+
label: 'theme:toggle',
143+
description: 'Toggle between light and dark mode',
144+
},
140145
{
141146
id: 'logout',
142147
label: 'logout',

0 commit comments

Comments
 (0)