diff --git a/src/index.ts b/src/index.ts index b0b35d8..891d78c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,5 @@ import joplin from 'api'; -import { ContentScriptType, SettingItemType } from 'api/types'; +import {ContentScriptType, SettingItemType} from 'api/types'; joplin.plugins.register({ onStart: async function() { @@ -14,9 +14,17 @@ joplin.plugins.register({ type: SettingItemType.String, section: 'abc', public: true, - label: 'ABC options', + label: 'ABC render options', description: 'Options that should be used whenever rendering an ABC code. It must be a JSON5 object. The full list of options is available at: https://paulrosen.github.io/abcjs/visual/render-abc-options.html', }, + 'forceLightTheme': { + value: true, + type: SettingItemType.Bool, + section: 'abc', + public: true, + label: 'Force light theme', + description: 'Forces the rendered output to be white and black (unless overriden by ABC render options); otherwise the sheet music will inherit the background and foreground colours of your selected theme.' + } }); await joplin.contentScripts.register( diff --git a/src/markdownItPlugin.ts b/src/markdownItPlugin.ts index ef3f2fc..b800489 100644 --- a/src/markdownItPlugin.ts +++ b/src/markdownItPlugin.ts @@ -48,13 +48,16 @@ export default function() { try { const globalOptions = parseOptions(pluginOptions.settingValue('options')); + const forceLightTheme = pluginOptions.settingValue('forceLightTheme'); element.setAttribute('id', elementId); element.style.display = 'none'; document.body.appendChild(element); const parsed = parseAbcContent(token.content); abcjs.renderAbc(elementId, parsed.markup, { ...globalOptions, ...parsed.options }); - html = '