Merge pull request #89945 from microsoft/misolori/fold-icon-themeable

Make folding icons themeable
This commit is contained in:
Martin Aeschlimann
2020-04-17 00:05:23 -07:00
committed by GitHub
+12 -1
View File
@@ -33,7 +33,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
import { onUnexpectedError } from 'vs/base/common/errors';
import { RawContextKey, IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { registerColor, editorSelectionBackground, transparent } from 'vs/platform/theme/common/colorRegistry';
import { registerColor, editorSelectionBackground, transparent, iconForeground } from 'vs/platform/theme/common/colorRegistry';
const CONTEXT_FOLDING_ENABLED = new RawContextKey<boolean>('foldingEnabled', false);
@@ -898,10 +898,21 @@ for (let i = 1; i <= 7; i++) {
}
export const foldBackgroundBackground = registerColor('editor.foldBackground', { light: transparent(editorSelectionBackground, 0.3), dark: transparent(editorSelectionBackground, 0.3), hc: null }, nls.localize('foldBackgroundBackground', "Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."), true);
export const editorFoldForeground = registerColor('editorGutter.foldingControlForeground', { dark: iconForeground, light: iconForeground, hc: iconForeground }, nls.localize('editorGutter.foldingControlForeground', 'Color of the folding control in the editor gutter.'));
registerThemingParticipant((theme, collector) => {
const foldBackground = theme.getColor(foldBackgroundBackground);
if (foldBackground) {
collector.addRule(`.monaco-editor .folded-background { background-color: ${foldBackground}; }`);
}
const editorFoldColor = theme.getColor(editorFoldForeground);
if (editorFoldColor) {
collector.addRule(`
.monaco-editor .cldr.codicon-chevron-right,
.monaco-editor .cldr.codicon-chevron-down {
color: ${editorFoldColor} !important;
}
`);
}
});