themes settings

This commit is contained in:
Lukas Bach 2024-02-23 23:12:21 +01:00
parent 65a9ab587a
commit 48d1bab6b4

View file

@ -1,5 +1,6 @@
import { App, PluginSettingTab, Setting } from "obsidian";
import CodeFilesPlugin from "./codeFilesPlugin";
import { themes } from "./themes";
export class CodeFilesSettingsTab extends PluginSettingTab {
plugin: CodeFilesPlugin;
@ -15,6 +16,44 @@ export class CodeFilesSettingsTab extends PluginSettingTab {
containerEl.empty();
containerEl.createEl("h2", { text: "Code Files Settings" });
containerEl.createEl("p", {
text: "If you change any settings, you need to reopen already opened files for the changes to take effect.",
});
new Setting(containerEl)
.setName("Theme")
.setDesc(
"Theme of the editor, defaults to dark or light based on the current editor theme."
)
.addDropdown((dropdown) => {
dropdown.addOption("default", "Default");
for (const theme of themes) {
dropdown.addOption(theme, theme);
}
return dropdown
.setValue(this.plugin.settings.theme)
.onChange(async (value) => {
this.plugin.settings.theme = value;
await this.plugin.saveSettings();
});
});
new Setting(containerEl)
.setName("Overwrite background with Obsidian background")
.setDesc(
"Always use the background of Obsidian as background, instead of the theme default background." +
" It's recommended to turn this off if you are using" +
" custom themes. Disable this if the text colors are illegible on Obsidians background."
)
.addToggle((toggle) =>
toggle
.setValue(this.plugin.settings.overwriteBg)
.onChange((v) => {
this.plugin.settings.overwriteBg = v;
this.plugin.saveSettings();
})
);
new Setting(containerEl)
.setName("File Extensions")