Merge pull request #76387 from skprabhanjan/fix-76141

Fix-76141 Add border around image in image preview
This commit is contained in:
Matt Bierner 2019-07-03 15:24:53 -07:00 committed by GitHub
commit bc7f5a7206
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View file

@ -21,6 +21,8 @@ import { IFileService } from 'vs/platform/files/common/files';
import { IStatusbarEntry, IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITheme, registerThemingParticipant, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
import { IMAGE_PREVIEW_BORDER } from 'vs/workbench/common/theme';
export interface IResourceDescriptor {
readonly resource: URI;
@ -67,6 +69,11 @@ interface ResourceViewerDelegate {
metadataClb(meta: string): void;
}
registerThemingParticipant((theme: ITheme, collector: ICssStyleCollector) => {
const borderColor = theme.getColor(IMAGE_PREVIEW_BORDER);
collector.addRule(`.monaco-resource-viewer.image img { border : 1px solid ${borderColor ? borderColor.toString() : ''}; }`);
});
/**
* Helper to actually render the given resource into the provided container. Will adjust scrollbar (if provided) automatically based on loading
* progress of the binary resource.

View file

@ -200,7 +200,13 @@ export const EDITOR_DRAG_AND_DROP_BACKGROUND = registerColor('editorGroup.dropBa
hc: null
}, nls.localize('editorDragAndDropBackground', "Background color when dragging editors around. The color should have transparency so that the editor contents can still shine through."));
// < --- Resource Viewer --- >
export const IMAGE_PREVIEW_BORDER = registerColor('imagePreview.border', {
dark: Color.fromHex('#808080').transparent(0.35),
light: Color.fromHex('#808080').transparent(0.35),
hc: contrastBorder
}, nls.localize('imagePreviewBorder', "Border color for image in image preview."));
// < --- Panels --- >