diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-04 16:18:12 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-04 16:41:51 +0900 |
commit | 65fedca9dfc4b85acce85b9eb3272cfc76d112a7 (patch) | |
tree | 7a0d8a7fbb0a053fb39dc67ef78166ab3c252a98 /src/console/actions | |
parent | 614778f6ad2633d90deffe6ef3d373c44967b10c (diff) |
Allow to change color scheme by "colorscheme" property
Diffstat (limited to 'src/console/actions')
-rw-r--r-- | src/console/actions/console.ts | 11 | ||||
-rw-r--r-- | src/console/actions/index.ts | 10 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/console/actions/console.ts b/src/console/actions/console.ts index 6282791..16d33b3 100644 --- a/src/console/actions/console.ts +++ b/src/console/actions/console.ts @@ -2,11 +2,13 @@ import * as messages from "../../shared/messages"; import * as actions from "./index"; import { Command } from "../../shared/Command"; import CompletionClient from "../clients/CompletionClient"; +import SettingClient from "../clients/SettingClient"; import CompletionType from "../../shared/CompletionType"; import Completions from "../Completions"; import TabFlag from "../../shared/TabFlag"; const completionClient = new CompletionClient(); +const settingClient = new SettingClient(); const commandDocs = { [Command.Set]: "Set a value of the property", @@ -272,6 +274,14 @@ const completionPrev = (): actions.CompletionPrevAction => { }; }; +const setColorScheme = async (): Promise<actions.SetColorSchemeAction> => { + const scheme = await settingClient.getColorScheme(); + return { + type: actions.CONSOLE_SET_COLORSCHEME, + colorscheme: scheme, + }; +}; + export { hide, showCommand, @@ -288,4 +298,5 @@ export { getPropertyCompletions, completionNext, completionPrev, + setColorScheme, }; diff --git a/src/console/actions/index.ts b/src/console/actions/index.ts index 308a093..6c1c759 100644 --- a/src/console/actions/index.ts +++ b/src/console/actions/index.ts @@ -1,5 +1,6 @@ import Completions from "../Completions"; import CompletionType from "../../shared/CompletionType"; +import ColorScheme from "../../shared/ColorScheme"; export const CONSOLE_HIDE = "console.hide"; export const CONSOLE_SHOW_COMMAND = "console.show.command"; @@ -11,6 +12,7 @@ export const CONSOLE_SET_COMPLETIONS = "console.set.completions"; export const CONSOLE_COMPLETION_NEXT = "console.completion.next"; export const CONSOLE_COMPLETION_PREV = "console.completion.prev"; export const CONSOLE_SHOW_FIND = "console.show.find"; +export const CONSOLE_SET_COLORSCHEME = "console.set.colorscheme"; export interface HideAction { type: typeof CONSOLE_HIDE; @@ -59,6 +61,11 @@ export interface CompletionPrevAction { type: typeof CONSOLE_COMPLETION_PREV; } +export interface SetColorSchemeAction { + type: typeof CONSOLE_SET_COLORSCHEME; + colorscheme: ColorScheme; +} + export type ConsoleAction = | HideAction | ShowCommand @@ -69,4 +76,5 @@ export type ConsoleAction = | SetConsoleTextAction | SetCompletionsAction | CompletionNextAction - | CompletionPrevAction; + | CompletionPrevAction + | SetColorSchemeAction; |