diff --git a/src/background/onInstalledListener.js b/src/background/onInstalledListener.js index 0b0f6b1..0cd3b76 100644 --- a/src/background/onInstalledListener.js +++ b/src/background/onInstalledListener.js @@ -2,7 +2,14 @@ import browser from "webextension-polyfill"; import log from "loglevel"; import { initSettings, getSettings, setSettings } from "src/settings/settings"; import { initShortcuts } from "./keyboardShortcuts"; - +import { + RESULT_FONT_COLOR_LIGHT, + RESULT_FONT_COLOR_DARK, + CANDIDATE_FONT_COLOR_LIGHT, + CANDIDATE_FONT_COLOR_DARK, + BG_COLOR_LIGHT, + BG_COLOR_DARK +} from "src/settings/defaultColors"; const logDir = "background/onInstalledListener"; const openOptionsPage = active => { @@ -22,4 +29,17 @@ export default async details => { const isShowOptionsPage = getSettings("isShowOptionsPageWhenUpdated"); if (isShowOptionsPage) openOptionsPage(false); setSettings("isShowUpdated", true); + + // Version 2.8.0以前からのアップデート + if (details.reason == "update" && details.previousVersion.replaceAll(".", "") < 280) { + //ユーザーが独自の色を設定していた場合、色の置き換えを有効にする + const isSetUserColor = + getSettings("resultFontColor") !== RESULT_FONT_COLOR_LIGHT && getSettings("resultFontColor") !== RESULT_FONT_COLOR_DARK || + getSettings("candidateFontColor") !== CANDIDATE_FONT_COLOR_LIGHT && getSettings("candidateFontColor") !== CANDIDATE_FONT_COLOR_DARK || + getSettings("bgColor") !== BG_COLOR_LIGHT && getSettings("bgColor") !== BG_COLOR_DARK; + + if (isSetUserColor) { + setSettings("isOverrideColors", true); + } + } };