提交 b85f6d7d 编写于 作者: S Sandeep Somavarapu

use editor error color as base color

上级 67f63fee
...@@ -38,7 +38,8 @@ import { ClassName } from 'vs/editor/common/model/intervalTree'; ...@@ -38,7 +38,8 @@ import { ClassName } from 'vs/editor/common/model/intervalTree';
import { ModelDecorationOptions } from 'vs/editor/common/model/textModel'; import { ModelDecorationOptions } from 'vs/editor/common/model/textModel';
import { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelLanguageConfigurationChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents'; import { IModelContentChangedEvent, IModelDecorationsChangedEvent, IModelLanguageChangedEvent, IModelLanguageConfigurationChangedEvent, IModelOptionsChangedEvent } from 'vs/editor/common/model/textModelEvents';
import * as modes from 'vs/editor/common/modes'; import * as modes from 'vs/editor/common/modes';
import { editorErrorBorder, editorErrorForeground, editorHintBorder, editorHintForeground, editorInfoBorder, editorInfoForeground, editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity, editorWarningBorder, editorWarningForeground } from 'vs/editor/common/view/editorColorRegistry'; import { editorUnnecessaryCodeBorder, editorUnnecessaryCodeOpacity } from 'vs/editor/common/view/editorColorRegistry';
import { editorErrorBorder, editorErrorForeground, editorHintBorder, editorHintForeground, editorInfoBorder, editorInfoForeground, editorWarningBorder, editorWarningForeground } from 'vs/platform/theme/common/colorRegistry';
import { VerticalRevealType } from 'vs/editor/common/view/viewEvents'; import { VerticalRevealType } from 'vs/editor/common/view/viewEvents';
import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer'; import { IEditorWhitespace } from 'vs/editor/common/viewLayout/whitespaceComputer';
import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl'; import { ViewModel } from 'vs/editor/common/viewModel/viewModelImpl';
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import * as nls from 'vs/nls'; import * as nls from 'vs/nls';
import { Color, RGBA } from 'vs/base/common/color'; import { Color, RGBA } from 'vs/base/common/color';
import { activeContrastBorder, editorBackground, editorForeground, registerColor } from 'vs/platform/theme/common/colorRegistry'; import { activeContrastBorder, editorBackground, editorForeground, registerColor, editorWarningForeground, editorInfoForeground, editorWarningBorder, editorInfoBorder } from 'vs/platform/theme/common/colorRegistry';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
/** /**
...@@ -37,26 +37,14 @@ export const editorOverviewRulerBorder = registerColor('editorOverviewRuler.bord ...@@ -37,26 +37,14 @@ export const editorOverviewRulerBorder = registerColor('editorOverviewRuler.bord
export const editorGutter = registerColor('editorGutter.background', { dark: editorBackground, light: editorBackground, hc: editorBackground }, nls.localize('editorGutter', 'Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.')); export const editorGutter = registerColor('editorGutter.background', { dark: editorBackground, light: editorBackground, hc: editorBackground }, nls.localize('editorGutter', 'Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.'));
export const editorErrorForeground = registerColor('editorError.foreground', { dark: '#ea4646', light: '#d60a0a', hc: null }, nls.localize('errorForeground', 'Foreground color of error squigglies in the editor.'));
export const editorErrorBorder = registerColor('editorError.border', { dark: null, light: null, hc: Color.fromHex('#E47777').transparent(0.8) }, nls.localize('errorBorder', 'Border color of error boxes in the editor.'));
export const editorWarningForeground = registerColor('editorWarning.foreground', { dark: '#FFCC00', light: '#E9A700', hc: null }, nls.localize('warningForeground', 'Foreground color of warning squigglies in the editor.'));
export const editorWarningBorder = registerColor('editorWarning.border', { dark: null, light: null, hc: Color.fromHex('#71B771').transparent(0.8) }, nls.localize('warningBorder', 'Border color of warning boxes in the editor.'));
export const editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#008000', light: '#008000', hc: null }, nls.localize('infoForeground', 'Foreground color of info squigglies in the editor.'));
export const editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hc: Color.fromHex('#71B771').transparent(0.8) }, nls.localize('infoBorder', 'Border color of info boxes in the editor.'));
export const editorHintForeground = registerColor('editorHint.foreground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hc: null }, nls.localize('hintForeground', 'Foreground color of hint squigglies in the editor.'));
export const editorHintBorder = registerColor('editorHint.border', { dark: null, light: null, hc: Color.fromHex('#eeeeee').transparent(0.8) }, nls.localize('hintBorder', 'Border color of hint boxes in the editor.'));
export const editorUnnecessaryCodeBorder = registerColor('editorUnnecessaryCode.border', { dark: null, light: null, hc: Color.fromHex('#fff').transparent(0.8) }, nls.localize('unnecessaryCodeBorder', 'Border color of unnecessary (unused) source code in the editor.')); export const editorUnnecessaryCodeBorder = registerColor('editorUnnecessaryCode.border', { dark: null, light: null, hc: Color.fromHex('#fff').transparent(0.8) }, nls.localize('unnecessaryCodeBorder', 'Border color of unnecessary (unused) source code in the editor.'));
export const editorUnnecessaryCodeOpacity = registerColor('editorUnnecessaryCode.opacity', { dark: Color.fromHex('#000a'), light: Color.fromHex('#0007'), hc: null }, nls.localize('unnecessaryCodeOpacity', 'Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the \'editorUnnecessaryCode.border\' theme color to underline unnecessary code instead of fading it out.')); export const editorUnnecessaryCodeOpacity = registerColor('editorUnnecessaryCode.opacity', { dark: Color.fromHex('#000a'), light: Color.fromHex('#0007'), hc: null }, nls.localize('unnecessaryCodeOpacity', 'Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the \'editorUnnecessaryCode.border\' theme color to underline unnecessary code instead of fading it out.'));
const rulerRangeDefault = new Color(new RGBA(0, 122, 204, 0.6)); const rulerRangeDefault = new Color(new RGBA(0, 122, 204, 0.6));
export const overviewRulerRangeHighlight = registerColor('editorOverviewRuler.rangeHighlightForeground', { dark: rulerRangeDefault, light: rulerRangeDefault, hc: rulerRangeDefault }, nls.localize('overviewRulerRangeHighlight', 'Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations.'), true); export const overviewRulerRangeHighlight = registerColor('editorOverviewRuler.rangeHighlightForeground', { dark: rulerRangeDefault, light: rulerRangeDefault, hc: rulerRangeDefault }, nls.localize('overviewRulerRangeHighlight', 'Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations.'), true);
export const overviewRulerError = registerColor('editorOverviewRuler.errorForeground', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hc: new Color(new RGBA(255, 50, 50, 1)) }, nls.localize('overviewRuleError', 'Overview ruler marker color for errors.')); export const overviewRulerError = registerColor('editorOverviewRuler.errorForeground', { dark: new Color(new RGBA(255, 18, 18, 0.7)), light: new Color(new RGBA(255, 18, 18, 0.7)), hc: new Color(new RGBA(255, 50, 50, 1)) }, nls.localize('overviewRuleError', 'Overview ruler marker color for errors.'));
export const overviewRulerWarning = registerColor('editorOverviewRuler.warningForeground', { dark: new Color(new RGBA(18, 136, 18, 0.7)), light: new Color(new RGBA(18, 136, 18, 0.7)), hc: new Color(new RGBA(50, 255, 50, 1)) }, nls.localize('overviewRuleWarning', 'Overview ruler marker color for warnings.')); export const overviewRulerWarning = registerColor('editorOverviewRuler.warningForeground', { dark: editorWarningForeground, light: editorWarningForeground, hc: editorWarningBorder }, nls.localize('overviewRuleWarning', 'Overview ruler marker color for warnings.'));
export const overviewRulerInfo = registerColor('editorOverviewRuler.infoForeground', { dark: new Color(new RGBA(18, 18, 136, 0.7)), light: new Color(new RGBA(18, 18, 136, 0.7)), hc: new Color(new RGBA(50, 50, 255, 1)) }, nls.localize('overviewRuleInfo', 'Overview ruler marker color for infos.')); export const overviewRulerInfo = registerColor('editorOverviewRuler.infoForeground', { dark: editorInfoForeground, light: editorInfoForeground, hc: editorInfoBorder }, nls.localize('overviewRuleInfo', 'Overview ruler marker color for infos.'));
// contains all color rules that used to defined in editor/browser/widget/editor.css // contains all color rules that used to defined in editor/browser/widget/editor.css
registerThemingParticipant((theme, collector) => { registerThemingParticipant((theme, collector) => {
......
...@@ -11,10 +11,9 @@ import { IMarker, MarkerSeverity, IRelatedInformation } from 'vs/platform/marker ...@@ -11,10 +11,9 @@ import { IMarker, MarkerSeverity, IRelatedInformation } from 'vs/platform/marker
import { Position } from 'vs/editor/common/core/position'; import { Position } from 'vs/editor/common/core/position';
import { Range } from 'vs/editor/common/core/range'; import { Range } from 'vs/editor/common/core/range';
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'; import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
import { registerColor, oneOf, textLinkForeground, severityIconErrorForeground, severityIconWarningForeground, severityIconInfoForeground } from 'vs/platform/theme/common/colorRegistry'; import { registerColor, oneOf, textLinkForeground, editorErrorForeground, editorWarningForeground, editorInfoForeground, editorErrorBorder, editorWarningBorder, editorInfoBorder } from 'vs/platform/theme/common/colorRegistry';
import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService'; import { IThemeService, ITheme, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { Color } from 'vs/base/common/color'; import { Color } from 'vs/base/common/color';
import { editorErrorForeground, editorErrorBorder, editorWarningForeground, editorWarningBorder, editorInfoForeground, editorInfoBorder } from 'vs/editor/common/view/editorColorRegistry';
import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement'; import { ScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollableElement';
import { ScrollbarVisibility } from 'vs/base/common/scrollable'; import { ScrollbarVisibility } from 'vs/base/common/scrollable';
import { ScrollType } from 'vs/editor/common/editorCommon'; import { ScrollType } from 'vs/editor/common/editorCommon';
...@@ -321,9 +320,9 @@ export class MarkerNavigationWidget extends PeekViewWidget { ...@@ -321,9 +320,9 @@ export class MarkerNavigationWidget extends PeekViewWidget {
// theming // theming
let errorDefault = oneOf(severityIconErrorForeground, editorErrorForeground, editorErrorBorder); let errorDefault = oneOf(editorErrorForeground, editorErrorBorder);
let warningDefault = oneOf(severityIconWarningForeground, editorWarningForeground, editorWarningBorder); let warningDefault = oneOf(editorWarningForeground, editorWarningBorder);
let infoDefault = oneOf(severityIconInfoForeground, editorInfoForeground, editorInfoBorder); let infoDefault = oneOf(editorInfoForeground, editorInfoBorder);
export const editorMarkerNavigationError = registerColor('editorMarkerNavigationError.background', { dark: errorDefault, light: errorDefault, hc: errorDefault }, nls.localize('editorMarkerNavigationError', 'Editor marker navigation widget error color.')); export const editorMarkerNavigationError = registerColor('editorMarkerNavigationError.background', { dark: errorDefault, light: errorDefault, hc: errorDefault }, nls.localize('editorMarkerNavigationError', 'Editor marker navigation widget error color.'));
export const editorMarkerNavigationWarning = registerColor('editorMarkerNavigationWarning.background', { dark: warningDefault, light: warningDefault, hc: warningDefault }, nls.localize('editorMarkerNavigationWarning', 'Editor marker navigation widget warning color.')); export const editorMarkerNavigationWarning = registerColor('editorMarkerNavigationWarning.background', { dark: warningDefault, light: warningDefault, hc: warningDefault }, nls.localize('editorMarkerNavigationWarning', 'Editor marker navigation widget warning color.'));
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
import Severity from 'vs/base/common/severity'; import Severity from 'vs/base/common/severity';
import { registerThemingParticipant, ITheme, LIGHT } from 'vs/platform/theme/common/themeService'; import { registerThemingParticipant, ITheme, LIGHT } from 'vs/platform/theme/common/themeService';
import { severityIconErrorForeground, severityIconWarningForeground, severityIconInfoForeground, severityIconIgnoreForeground } from 'vs/platform/theme/common/colorRegistry'; import { editorErrorForeground, editorWarningForeground, editorInfoForeground, editorHintForeground } from 'vs/platform/theme/common/colorRegistry';
import { Color } from 'vs/base/common/color';
const errorStart = encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><circle cx="8" cy="8" r="6" fill="#F6F6F6"/><path d="M8 3C5.238 3 3 5.238 3 8s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5zm3 7l-1 1-2-2-2 2-1-1 2-2.027L5 6l1-1 2 2 2-2 1 1-2 1.973L11 10z" fill="`); const errorStart = encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" enable-background="new 0 0 16 16" height="16" width="16"><circle cx="8" cy="8" r="6" fill="#F6F6F6"/><path d="M8 3C5.238 3 3 5.238 3 8s2.238 5 5 5 5-2.238 5-5-2.238-5-5-5zm3 7l-1 1-2-2-2 2-1-1 2-2.027L5 6l1-1 2 2 2-2 1 1-2 1.973L11 10z" fill="`);
const errorEnd = encodeURIComponent(`"/><path fill="#fff" d="M11 6l-1-1-2 2-2-2-1 1 2 1.973L5 10l1 1 2-2 2 2 1-1-2-2.027z"/></svg>`); const errorEnd = encodeURIComponent(`"/><path fill="#fff" d="M11 6l-1-1-2 2-2-2-1 1 2 1.973L5 10l1 1 2-2 2 2 1-1-2-2.027z"/></svg>`);
...@@ -27,33 +28,21 @@ export namespace SeverityIcon { ...@@ -27,33 +28,21 @@ export namespace SeverityIcon {
export function getSVGData(severity: Severity, theme: ITheme): string { export function getSVGData(severity: Severity, theme: ITheme): string {
switch (severity) { switch (severity) {
case Severity.Ignore: case Severity.Ignore:
const ignoreColor = theme.getColor(severityIconIgnoreForeground); const ignoreColor = theme.getColor(editorHintForeground) || (theme.type === LIGHT ? Color.fromHex('#1BA1E2') : Color.fromHex('#1BA1E2'));
if (ignoreColor) { return theme.type === LIGHT ? infoStart + encodeURIComponent(ignoreColor.toString()) + infoEnd
return theme.type === LIGHT ? infoStart + encodeURIComponent(ignoreColor.toString()) + infoEnd : infoDarkStart + encodeURIComponent(ignoreColor.toString()) + infoDarkEnd;
: infoDarkStart + encodeURIComponent(ignoreColor.toString()) + infoDarkEnd;
}
return '';
case Severity.Info: case Severity.Info:
const infoColor = theme.getColor(severityIconInfoForeground); const infoColor = theme.getColor(editorInfoForeground) || (theme.type === LIGHT ? Color.fromHex('#1BA1E2') : Color.fromHex('#1BA1E2'));
if (infoColor) { return theme.type === LIGHT ? infoStart + encodeURIComponent(infoColor.toString()) + infoEnd
return theme.type === LIGHT ? infoStart + encodeURIComponent(infoColor.toString()) + infoEnd : infoDarkStart + encodeURIComponent(infoColor.toString()) + infoDarkEnd;
: infoDarkStart + encodeURIComponent(infoColor.toString()) + infoDarkEnd;
}
return '';
case Severity.Warning: case Severity.Warning:
const warningColor = theme.getColor(severityIconWarningForeground); const warningColor = theme.getColor(editorWarningForeground) || (theme.type === LIGHT ? Color.fromHex('#fc0') : Color.fromHex('#fc0'));
if (warningColor) { return theme.type === LIGHT ? warningStart + encodeURIComponent(warningColor.toString()) + warningEnd
return theme.type === LIGHT ? warningStart + encodeURIComponent(warningColor.toString()) + warningEnd : warningDarkStart + encodeURIComponent(warningColor.toString()) + warningDarkEnd;
: warningDarkStart + encodeURIComponent(warningColor.toString()) + warningDarkEnd;
}
return '';
case Severity.Error: case Severity.Error:
const errorColor = theme.getColor(severityIconErrorForeground); const errorColor = theme.getColor(editorErrorForeground) || (theme.type === LIGHT ? Color.fromHex('#E51400') : Color.fromHex('#F48771'));
if (errorColor) { return theme.type === LIGHT ? errorStart + encodeURIComponent(errorColor.toString()) + errorEnd
return theme.type === LIGHT ? errorStart + encodeURIComponent(errorColor.toString()) + errorEnd : errorDarkStart + encodeURIComponent(errorColor.toString()) + errorDarkEnd;
: errorDarkStart + encodeURIComponent(errorColor.toString()) + errorDarkEnd;
}
return '';
} }
return ''; return '';
} }
......
...@@ -264,10 +264,17 @@ export const menuSelectionBackground = registerColor('menu.selectionBackground', ...@@ -264,10 +264,17 @@ export const menuSelectionBackground = registerColor('menu.selectionBackground',
export const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('menuSelectionBorder', "Border color of the selected menu item in menus.")); export const menuSelectionBorder = registerColor('menu.selectionBorder', { dark: null, light: null, hc: activeContrastBorder }, nls.localize('menuSelectionBorder', "Border color of the selected menu item in menus."));
export const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#BBBBBB', light: '#888888', hc: contrastBorder }, nls.localize('menuSeparatorBackground', "Color of a separator menu item in menus.")); export const menuSeparatorBackground = registerColor('menu.separatorBackground', { dark: '#BBBBBB', light: '#888888', hc: contrastBorder }, nls.localize('menuSeparatorBackground', "Color of a separator menu item in menus."));
export const severityIconErrorForeground = registerColor('severity.errorForeground', { dark: '#ea4646', light: '#d60a0a', hc: null }, nls.localize('severity.errorForeground', 'Foreground color of error icon.')); export const editorErrorForeground = registerColor('editorError.foreground', { dark: '#F48771', light: '#E51400', hc: null }, nls.localize('editorError.foreground', 'Foreground color of error squigglies in the editor.'));
export const severityIconWarningForeground = registerColor('severity.warningForeground', { dark: '#FFCC00', light: '#E9A700', hc: null }, nls.localize('severity.warningForeground', 'Foreground color of warning icon.')); export const editorErrorBorder = registerColor('editorError.border', { dark: null, light: null, hc: Color.fromHex('#E47777').transparent(0.8) }, nls.localize('errorBorder', 'Border color of error boxes in the editor.'));
export const severityIconInfoForeground = registerColor('severity.infoForeground', { dark: '#008000', light: '#008000', hc: null }, nls.localize('severity.infoForeground', 'Foreground color of info icon.'));
export const severityIconIgnoreForeground = registerColor('severity.ignoreForeground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hc: null }, nls.localize('severity.ignoreForeground', 'Foreground color of ignore icon.')); export const editorWarningForeground = registerColor('editorWarning.foreground', { dark: '#FFCC00', light: '#E9A700', hc: null }, nls.localize('editorWarning.foreground', 'Foreground color of warning squigglies in the editor.'));
export const editorWarningBorder = registerColor('editorWarning.border', { dark: null, light: null, hc: Color.fromHex('#FFCC00').transparent(0.8) }, nls.localize('warningBorder', 'Border color of warning boxes in the editor.'));
export const editorInfoForeground = registerColor('editorInfo.foreground', { dark: '#008000', light: '#008000', hc: null }, nls.localize('editorInfo.foreground', 'Foreground color of info squigglies in the editor.'));
export const editorInfoBorder = registerColor('editorInfo.border', { dark: null, light: null, hc: Color.fromHex('#71B771').transparent(0.8) }, nls.localize('infoBorder', 'Border color of info boxes in the editor.'));
export const editorHintForeground = registerColor('editorHint.foreground', { dark: Color.fromHex('#eeeeee').transparent(0.7), light: '#6c6c6c', hc: null }, nls.localize('editorHint.foreground', 'Foreground color of hint squigglies in the editor.'));
export const editorHintBorder = registerColor('editorHint.border', { dark: null, light: null, hc: Color.fromHex('#eeeeee').transparent(0.8) }, nls.localize('hintBorder', 'Border color of hint boxes in the editor.'));
/** /**
* Editor background color. * Editor background color.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册