diff --git a/src/background.js b/src/background.js index 59a9e31..cae6d53 100644 --- a/src/background.js +++ b/src/background.js @@ -63,6 +63,16 @@ chrome.runtime.onInstalled.addListener((details) => { chrome.storage.local.remove(oldOptionName); } } + /** + * Ensure updated structure of highlighter objects + */ + for (const highlighterIndex of currentOptions.highlighter) { + for (const attributeName of Object.keys(defaultOptions.highlighter)) { + if (!(attributeName in currentOptions.highlighter[highlighterIndex])) { + chrome.storage.local.set({ highlighter: defaultOptions.highlighter }); + } + } + } /** * Convert any non-hex colors to hex. */