Skip to content

Commit

Permalink
Upper case theme name.
Browse files Browse the repository at this point in the history
  • Loading branch information
cweijan committed Mar 4, 2024
1 parent ca76d4c commit dd8f318
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 5 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,9 +461,9 @@
"vscode-office.editorTheme": {
"type": "string",
"enum": [
"light",
"auto",
"solarized"
"Auto",
"Light",
"Solarized"
],
"default": "light",
"markdownDescription": "The theme for the Markdown editor."
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions resource/vditor/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ a {

.win32 *{
text-shadow: 0 0 0.55px #7c7c7cdd;
}

.vditor-toolbar__item .vditor-tooltipped[data-type="selectTheme"]{
width: 55px;
font-size: 14px;
color: var(--vscode-charts-red);
}
8 changes: 8 additions & 0 deletions resource/vditor/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ export async function getToolbar(resPath) {
},
{ name: 'upload', tipPosition: 'e' },
"|",
{
name:'selectTheme',
tipPosition: 's', tip: 'Select Theme',
icon: 'Theme:',
click() {
handler.emit("theme")
}
},
{
tipPosition: 's', tip: 'Select Theme',
icon: await loadRes(`${resPath}/icon/theme.svg`),
Expand Down
12 changes: 10 additions & 2 deletions src/provider/markdownEditorProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,16 @@ export class MarkdownEditorProvider implements vscode.CustomTextEditorProvider {
}).on("export", (option) => {
vscode.commands.executeCommand('workbench.action.files.save');
new MarkdownService(this.context).exportMarkdown(uri, option)
}).on("theme", () => {
vscode.commands.executeCommand('workbench.action.selectTheme');
}).on("theme", async (theme) => {
if (!theme) {
const themes = ["Auto", "Light", "Solarized"]
const editorTheme = Global.getConfig('editorTheme');
const themeItems: vscode.QuickPickItem[] = themes.map(theme => ({ label: theme, description: theme == editorTheme ? 'Current' : undefined }))
theme = await vscode.window.showQuickPick(themeItems, { placeHolder: "Select Editor Theme" });
if (!theme) return
}
handler.emit('theme', theme.label)
Global.updateConfig('editorTheme', theme.label)
}).on("saveOutline", (enable) => {
config.update("openOutline", enable, true)
}).on('developerTool', () => {
Expand Down

0 comments on commit dd8f318

Please sign in to comment.