EditorColorsScheme (EditorEx editor) { boolean isLaFDark = ColorUtil.isDark(UIUtil.getPanelBackground()); boolean isEditorDark = EditorColorsManager.getInstance().isDarkEditor(); EditorColorsScheme colorsScheme = isLaFDark == isEditorDark ? EditorColorsManager.getInstance().getGlobalScheme() : EditorColorsManager.getInstance().getSchemeForCurrentUITheme(); // We have to wrap the colorsScheme into a scheme delegate in order to avoid editing the global scheme colorsScheme = editor.createBoundColorSchemeDelegate(colorsScheme); colorsScheme.setEditorFontSize(UISettingsUtils.getInstance().getScaledEditorFontSize()); return colorsScheme; }