mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-23 15:24:20 +01:00
Merge pull request #165576 from GauravB159/registerThemeParticipant-refactoring
Register theme participant refactoring
This commit is contained in:
@@ -7,4 +7,8 @@
|
||||
padding: 10px;
|
||||
vertical-align: middle;
|
||||
overflow: auto;
|
||||
background-color: var(--vscode-editorWidget-background);
|
||||
color: var(--vscode-editorWidget-foreground);
|
||||
box-shadow: 0 2px 8px var(--vscode-widget-shadow);
|
||||
border: 2px solid var(--vscode-contrastBorder);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,6 @@ import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiati
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { contrastBorder, editorWidgetBackground, widgetShadow, editorWidgetForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { AccessibilitySupport } from 'vs/platform/accessibility/common/accessibility';
|
||||
import { Action2, registerAction2 } from 'vs/platform/actions/common/actions';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
@@ -329,25 +327,3 @@ registerEditorCommand(new AccessibilityHelpCommand({
|
||||
primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape]
|
||||
}
|
||||
}));
|
||||
|
||||
registerThemingParticipant((theme, collector) => {
|
||||
const widgetBackground = theme.getColor(editorWidgetBackground);
|
||||
if (widgetBackground) {
|
||||
collector.addRule(`.monaco-editor .accessibilityHelpWidget { background-color: ${widgetBackground}; }`);
|
||||
}
|
||||
|
||||
const widgetForeground = theme.getColor(editorWidgetForeground);
|
||||
if (widgetBackground) {
|
||||
collector.addRule(`.monaco-editor .accessibilityHelpWidget { color: ${widgetForeground}; }`);
|
||||
}
|
||||
|
||||
const widgetShadowColor = theme.getColor(widgetShadow);
|
||||
if (widgetShadowColor) {
|
||||
collector.addRule(`.monaco-editor .accessibilityHelpWidget { box-shadow: 0 2px 8px ${widgetShadowColor}; }`);
|
||||
}
|
||||
|
||||
const hcBorder = theme.getColor(contrastBorder);
|
||||
if (hcBorder) {
|
||||
collector.addRule(`.monaco-editor .accessibilityHelpWidget { border: 2px solid ${hcBorder}; }`);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -19,5 +19,5 @@ import './toggleMultiCursorModifier';
|
||||
import './toggleRenderControlCharacter';
|
||||
import './toggleRenderWhitespace';
|
||||
import './toggleWordWrap';
|
||||
import './untitledTextEditorHint';
|
||||
import './untitledTextEditorHint/untitledTextEditorHint';
|
||||
import './workbenchReferenceSearch';
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
align-items: center;
|
||||
pointer-events: all;
|
||||
transition: top 200ms linear;
|
||||
background-color: var(--vscode-editorWidget-background) !important;
|
||||
color: var(--vscode-editorWidget-foreground);
|
||||
box-shadow: 0 0 8px 2px var(--vscode-widget-shadow);
|
||||
border: 1px solid var(--vscode-contrastBorder);
|
||||
}
|
||||
|
||||
.monaco-workbench.reduce-motion .monaco-editor .find-widget {
|
||||
@@ -83,3 +87,13 @@
|
||||
div.simple-find-part-wrapper div.button {
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.no-results.matchesCount {
|
||||
color: var(--vscode-errorForeground);
|
||||
}
|
||||
|
||||
div.simple-find-part-wrapper div.button:hover:not(.disabled) {
|
||||
background-color: var(--vscode-toolbar-hoverBackground);
|
||||
outline: 1px dashed var(--vscode-toolbar-hoverOutline);
|
||||
outline-offset: -1px;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ import { IMessage as InputBoxMessage } from 'vs/base/browser/ui/inputbox/inputBo
|
||||
import { SimpleButton, findPreviousMatchIcon, findNextMatchIcon, NLS_NO_RESULTS, NLS_MATCHES_LOCATION } from 'vs/editor/contrib/find/browser/findWidget';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { IContextViewService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { editorWidgetBackground, inputActiveOptionBorder, inputActiveOptionBackground, inputActiveOptionForeground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground, widgetShadow, editorWidgetForeground, errorForeground, toolbarHoverBackground, toolbarHoverOutline, contrastBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IColorTheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { inputActiveOptionBorder, inputActiveOptionBackground, inputActiveOptionForeground, inputBackground, inputBorder, inputForeground, inputValidationErrorBackground, inputValidationErrorBorder, inputValidationErrorForeground, inputValidationInfoBackground, inputValidationInfoBorder, inputValidationInfoForeground, inputValidationWarningBackground, inputValidationWarningBorder, inputValidationWarningForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { IColorTheme } from 'vs/platform/theme/common/themeService';
|
||||
import { ContextScopedFindInput } from 'vs/platform/history/browser/contextScopedHistoryWidget';
|
||||
import { widgetClose } from 'vs/platform/theme/common/iconRegistry';
|
||||
import * as strings from 'vs/base/common/strings';
|
||||
@@ -395,50 +395,3 @@ export abstract class SimpleFindWidget extends Widget {
|
||||
return nls.localize('ariaSearchNoResultWithLineNumNoCurrentMatch', "{0} found for '{1}'", label, searchString);
|
||||
}
|
||||
}
|
||||
|
||||
// theming
|
||||
registerThemingParticipant((theme, collector) => {
|
||||
const findWidgetBGColor = theme.getColor(editorWidgetBackground);
|
||||
if (findWidgetBGColor) {
|
||||
collector.addRule(`.monaco-workbench .simple-find-part { background-color: ${findWidgetBGColor} !important; }`);
|
||||
}
|
||||
|
||||
const widgetForeground = theme.getColor(editorWidgetForeground);
|
||||
if (widgetForeground) {
|
||||
collector.addRule(`.monaco-workbench .simple-find-part { color: ${widgetForeground}; }`);
|
||||
}
|
||||
|
||||
const widgetShadowColor = theme.getColor(widgetShadow);
|
||||
if (widgetShadowColor) {
|
||||
collector.addRule(`.monaco-workbench .simple-find-part { box-shadow: 0 0 8px 2px ${widgetShadowColor}; }`);
|
||||
}
|
||||
|
||||
const hcBorder = theme.getColor(contrastBorder);
|
||||
if (hcBorder) {
|
||||
collector.addRule(`.monaco-workbench .simple-find-part { border: 1px solid ${hcBorder}; }`);
|
||||
}
|
||||
|
||||
const error = theme.getColor(errorForeground);
|
||||
if (error) {
|
||||
collector.addRule(`.no-results.matchesCount { color: ${error}; }`);
|
||||
}
|
||||
|
||||
const toolbarHoverBackgroundColor = theme.getColor(toolbarHoverBackground);
|
||||
if (toolbarHoverBackgroundColor) {
|
||||
collector.addRule(`
|
||||
div.simple-find-part-wrapper div.button:hover:not(.disabled) {
|
||||
background-color: ${toolbarHoverBackgroundColor};
|
||||
}
|
||||
`);
|
||||
}
|
||||
|
||||
const toolbarHoverOutlineColor = theme.getColor(toolbarHoverOutline);
|
||||
if (toolbarHoverOutlineColor) {
|
||||
collector.addRule(`
|
||||
div.simple-find-part-wrapper div.button:hover:not(.disabled) {
|
||||
outline: 1px dashed ${toolbarHoverOutlineColor};
|
||||
outline-offset: -1px;
|
||||
}
|
||||
`);
|
||||
}
|
||||
});
|
||||
|
||||
+8
@@ -10,6 +10,14 @@
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.monaco-editor .token-inspect-widget {
|
||||
background-color: var(--vscode-editorHoverWidget-background);
|
||||
}
|
||||
|
||||
.monaco-editor .token-inspect-widget .tiw-metadata-separator {
|
||||
background-color: var(--vscode-editorHoverWidget-border)
|
||||
}
|
||||
|
||||
.tiw-token {
|
||||
font-family: var(--monaco-monospace-font);
|
||||
}
|
||||
|
||||
+1
-6
@@ -20,7 +20,7 @@ import { SemanticTokensLegend, SemanticTokens } from 'vs/editor/common/languages
|
||||
import { FontStyle, ColorId, StandardTokenType, TokenMetadata } from 'vs/editor/common/encodedTokenAttributes';
|
||||
import { ILanguageService } from 'vs/editor/common/languages/language';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { editorHoverBackground, editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { editorHoverBorder } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { findMatchingThemeRule } from 'vs/workbench/services/textMate/common/TMHelper';
|
||||
import { ITextMateService } from 'vs/workbench/services/textMate/browser/textMate';
|
||||
@@ -676,10 +676,5 @@ registerThemingParticipant((theme, collector) => {
|
||||
if (border) {
|
||||
const borderWidth = isHighContrast(theme.type) ? 2 : 1;
|
||||
collector.addRule(`.monaco-editor .token-inspect-widget { border: ${borderWidth}px solid ${border}; }`);
|
||||
collector.addRule(`.monaco-editor .token-inspect-widget .tiw-metadata-separator { background-color: ${border}; }`);
|
||||
}
|
||||
const background = theme.getColor(editorHoverBackground);
|
||||
if (background) {
|
||||
collector.addRule(`.monaco-editor .token-inspect-widget { background-color: ${background}; }`);
|
||||
}
|
||||
});
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
.monaco-editor .contentWidgets .untitled-hint {
|
||||
color: var(--vscode-input-placeholderForeground);
|
||||
}
|
||||
|
||||
.monaco-editor .contentWidgets .untitled-hint a {
|
||||
color: var(--vscode-textLink-foreground)
|
||||
}
|
||||
+1
-13
@@ -3,12 +3,11 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import 'vs/css!./untitledTextEditorHint';
|
||||
import * as dom from 'vs/base/browser/dom';
|
||||
import { DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
|
||||
import { localize } from 'vs/nls';
|
||||
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { inputPlaceholderForeground, textLinkForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
import { ChangeLanguageAction } from 'vs/workbench/browser/parts/editor/editorStatus';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { PLAINTEXT_LANGUAGE_ID } from 'vs/editor/common/languages/modesRegistry';
|
||||
@@ -193,15 +192,4 @@ class UntitledTextEditorHintContentWidget implements IContentWidget {
|
||||
}
|
||||
}
|
||||
|
||||
registerThemingParticipant((theme, collector) => {
|
||||
const inputPlaceholderForegroundColor = theme.getColor(inputPlaceholderForeground);
|
||||
if (inputPlaceholderForegroundColor) {
|
||||
collector.addRule(`.monaco-editor .contentWidgets .untitled-hint { color: ${inputPlaceholderForegroundColor}; }`);
|
||||
}
|
||||
const textLinkForegroundColor = theme.getColor(textLinkForeground);
|
||||
if (textLinkForegroundColor) {
|
||||
collector.addRule(`.monaco-editor .contentWidgets .untitled-hint a { color: ${textLinkForegroundColor}; }`);
|
||||
}
|
||||
});
|
||||
|
||||
registerEditorContribution(UntitledTextEditorHintContribution.ID, UntitledTextEditorHintContribution);
|
||||
Reference in New Issue
Block a user