Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: adopt css variables #168933

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/vs/workbench/contrib/testing/browser/media/testing.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,32 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

/** -- icons */

.monaco-workbench .codicon-testing-error-icon {
color: var(--vscode-testing-iconErrored);
}

.monaco-workbench .codicon-testing-failed-icon {
color: var(--vscode-testing-iconFailed);
}

.monaco-workbench .codicon-testing-passed-icon {
color: var(--vscode-testing-iconPassed);
}

.monaco-workbench .codicon-testing-queued-icon {
color: var(--vscode-testing-iconQueued);
}

.monaco-workbench .codicon-testing-skipped-icon {
color: var(--vscode-testing-iconSkipped);
}

.monaco-workbench .codicon-testing-unset-icon {
color: var(--vscode-testing-iconUnset);
}

/** -- explorer */
.test-explorer {
display: flex;
Expand Down Expand Up @@ -176,6 +202,12 @@
align-items: center;
}

.testing-filter-action-item > .monaco-action-bar .testing-filter-button.checked {
border-color: var(--vscode-inputOption-activeBorder);
color: var(--vscode-inputOption-activeForeground);
background-color: var(--vscode-inputOption-activeBackground);
}

.testing-filter-action-bar .testing-filter-action-item {
max-width: none;
}
Expand Down Expand Up @@ -205,6 +237,7 @@

.monaco-editor .testing-run-glyph {
cursor: pointer;
color: var(--vscode-testingColorRunAction);
}

.testing-diff-title-widget {
Expand Down Expand Up @@ -233,3 +266,22 @@
font-size: .9em;
white-space: pre;
}

.testing-diff-lens-widget {
color: var(--vscode-editorCodeLens-foreground);
}

.test-message-inline-content-s0 {
color: var(--vscode-testing-message-error-decorationForeground) !important;
}

.test-message-inline-content-s1 {
color: var(--vscode-testing-message-info-decorationForeground) !important;
}

.monaco-editor .testing-inline-message-severity-0 {
color: var(--vscode-testing-message-error-decorationForeground) !important;
}
.monaco-editor .testing-inline-message-severity-1 {
color: var(--vscode-testing-message-info-decorationForeground) !important;
}
16 changes: 2 additions & 14 deletions src/vs/workbench/contrib/testing/browser/testingDecorations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { generateUuid } from 'vs/base/common/uuid';
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidgetPosition, IEditorMouseEvent, MouseTargetType } from 'vs/editor/browser/editorBrowser';
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
import { EditorOption } from 'vs/editor/common/config/editorOptions';
import { editorCodeLensForeground, overviewRulerError, overviewRulerInfo } from 'vs/editor/common/core/editorColorRegistry';
import { overviewRulerError, overviewRulerInfo } from 'vs/editor/common/core/editorColorRegistry';
import { IRange, Range } from 'vs/editor/common/core/range';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { IModelDeltaDecoration, ITextModel, OverviewRulerLane, TrackedRangeStickiness } from 'vs/editor/common/model';
Expand All @@ -33,12 +33,11 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { registerThemingParticipant, themeColorFromId, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { themeColorFromId, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity';
import { BREAKPOINT_EDITOR_CONTRIBUTION_ID, IBreakpointEditorContribution } from 'vs/workbench/contrib/debug/common/debug';
import { getTestItemContextOverlay } from 'vs/workbench/contrib/testing/browser/explorerProjections/testItemContextOverlay';
import { testingRunAllIcon, testingRunIcon, testingStatesToIcons } from 'vs/workbench/contrib/testing/browser/icons';
import { testMessageSeverityColors } from 'vs/workbench/contrib/testing/browser/theme';
import { DefaultGutterClickAction, getTestingConfiguration, TestingConfigKeys } from 'vs/workbench/contrib/testing/common/configuration';
import { labelForTestInState, Testing } from 'vs/workbench/contrib/testing/common/constants';
import { TestId } from 'vs/workbench/contrib/testing/common/testId';
Expand Down Expand Up @@ -997,14 +996,3 @@ class TestMessageDecoration implements ITestDecoration {
return false;
}
}

registerThemingParticipant((theme, collector) => {
const codeLensForeground = theme.getColor(editorCodeLensForeground);
if (codeLensForeground) {
collector.addRule(`.testing-diff-lens-widget { color: ${codeLensForeground}; }`);
}

for (const [severity, { decorationForeground }] of Object.entries(testMessageSeverityColors)) {
collector.addRule(`.test-message-inline-content-s${severity} { color: ${theme.getColor(decorationForeground)} !important }`);
}
});
32 changes: 1 addition & 31 deletions src/vs/workbench/contrib/testing/browser/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

import { Color, RGBA } from 'vs/base/common/color';
import { localize } from 'vs/nls';
import { contrastBorder, editorErrorForeground, editorForeground, inputActiveOptionBackground, inputActiveOptionBorder, inputActiveOptionForeground, registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { ACTIVITY_BAR_BADGE_BACKGROUND } from 'vs/workbench/common/theme';
import { contrastBorder, editorErrorForeground, editorForeground, registerColor, transparent } from 'vs/platform/theme/common/colorRegistry';
import { TestMessageType, TestResultState } from 'vs/workbench/contrib/testing/common/testTypes';

export const testingColorIconFailed = registerColor('testing.iconFailed', {
Expand Down Expand Up @@ -113,31 +111,3 @@ export const testStatesToIconColors: { [K in TestResultState]?: string } = {
[TestResultState.Unset]: testingColorIconUnset,
[TestResultState.Skipped]: testingColorIconSkipped,
};


registerThemingParticipant((theme, collector) => {
//#region test states
for (const [state, { marginBackground }] of Object.entries(testMessageSeverityColors)) {
collector.addRule(`.monaco-editor .testing-inline-message-severity-${state} {
background: ${theme.getColor(marginBackground)};
}`);
}
//#endregion test states

//#region active buttons
const inputActiveOptionBorderColor = theme.getColor(inputActiveOptionBorder);
if (inputActiveOptionBorderColor) {
collector.addRule(`.testing-filter-action-item > .monaco-action-bar .testing-filter-button.checked { border-color: ${inputActiveOptionBorderColor}; }`);
}
const inputActiveOptionForegroundColor = theme.getColor(inputActiveOptionForeground);
if (inputActiveOptionForegroundColor) {
collector.addRule(`.testing-filter-action-item > .monaco-action-bar .testing-filter-button.checked { color: ${inputActiveOptionForegroundColor}; }`);
}
const inputActiveOptionBackgroundColor = theme.getColor(inputActiveOptionBackground);
if (inputActiveOptionBackgroundColor) {
collector.addRule(`.testing-filter-action-item > .monaco-action-bar .testing-filter-button.checked { background-color: ${inputActiveOptionBackgroundColor}; }`);
}
const badgeColor = theme.getColor(ACTIVITY_BAR_BADGE_BACKGROUND);
collector.addRule(`.monaco-workbench .part > .title > .title-actions .action-label.codicon-testing-autorun::after { background-color: ${badgeColor}; }`);
//#endregion
});