Skip to content

Commit

Permalink
feat: add colorblind setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kometenstaub committed Mar 13, 2022
1 parent ac77313 commit 34d42b6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/diff_view.ts
Expand Up @@ -50,6 +50,9 @@ export default class DiffView extends Modal {
this.syncHistoryContentContainer = this.contentEl.createDiv({
cls: ['sync-history-content-container', 'diff'],
});
if (this.plugin.settings.colorBlind) {
this.syncHistoryContentContainer.addClass('colorblind');
}
this.createHtml();
}

Expand Down
1 change: 1 addition & 0 deletions src/interfaces.ts
@@ -1,6 +1,7 @@
export interface OpenSyncHistorySettings {
//context: string;
diffStyle: 'word' | 'char';
colorBlind: boolean;
}

declare module 'obsidian' {
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Expand Up @@ -7,6 +7,7 @@ import DiffView from './diff_view';
const DEFAULT_SETTINGS: OpenSyncHistorySettings = {
//context: '3',
diffStyle: 'word',
colorBlind: false,
};

export default class OpenSyncHistoryPlugin extends Plugin {
Expand Down
12 changes: 12 additions & 0 deletions src/settings.ts
Expand Up @@ -52,5 +52,17 @@ export default class OpenSyncHistorySettingTab extends PluginSettingTab {
await this.plugin.saveSettings();
});
});

new Setting(containerEl)
.setName('Colour-blindness')
.setDesc('Enable colour-blind mode')
.addToggle((toggle) => {
toggle
.setValue(this.plugin.settings.colorBlind)
.onChange(async (state) => {
this.plugin.settings.colorBlind = state;
await this.plugin.saveSettings();
});
});
}
}

0 comments on commit 34d42b6

Please sign in to comment.