Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/vs/platform/theme/common/colorRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ export interface IColorRegistry {
* Register a color to the registry.
* @param id The color id as used in theme description files
* @param defaults The default values
* @param needsTransparency Whether the color requires transparency
* @description the description
*/
registerColor(id: string, defaults: ColorDefaults, description: string): ColorIdentifier;
registerColor(id: string, defaults: ColorDefaults, description: string, needsTransparency?: boolean): ColorIdentifier;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't expect an option boolean parameter to registerColor to control linting settings, so I'd make it an option:

Suggested change
registerColor(id: string, defaults: ColorDefaults, description: string, needsTransparency?: boolean): ColorIdentifier;
registerColor(id: string, defaults: ColorDefaults, description: string, options?: { needsTransparency?: boolean }): ColorIdentifier;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aeschli shall I do this consider we're exposing it on the registry interface now?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is fine, but not really needed. ColorRegistry.registerColor already has that parameter and it is used at several places. @hediet I can make the suggested change when we get more arguments


/**
* Register a color to the registry.
Expand Down Expand Up @@ -139,6 +140,10 @@ class ColorRegistry implements IColorRegistry {
if (deprecationMessage) {
propertySchema.deprecationMessage = deprecationMessage;
}
if (needsTransparency) {
propertySchema.pattern = '^#(?:(?<rgba>[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$';
propertySchema.patternErrorMessage = 'This color must be transparent or it will obscure content';
}
this.colorSchema.properties[id] = propertySchema;
this.colorReferenceSchema.enum.push(id);
this.colorReferenceSchema.enumDescriptions.push(description);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const TERMINAL_FIND_MATCH_BACKGROUND_COLOR = registerColor('terminal.find
// Use regular selection background in high contrast with a thick border
hcDark: null,
hcLight: '#0F4A85'
}, nls.localize('terminal.findMatchBackground', 'Color of the current search match in the terminal. The color must not be opaque so as not to hide underlying terminal content.'));
}, nls.localize('terminal.findMatchBackground', 'Color of the current search match in the terminal. The color must not be opaque so as not to hide underlying terminal content.'), true);
export const TERMINAL_HOVER_HIGHLIGHT_BACKGROUND_COLOR = registerColor('terminal.hoverHighlightBackground', {
dark: transparent(editorHoverHighlight, 0.5),
light: transparent(editorHoverHighlight, 0.5),
Expand All @@ -95,7 +95,7 @@ export const TERMINAL_FIND_MATCH_HIGHLIGHT_BACKGROUND_COLOR = registerColor('ter
light: editorFindMatchHighlight,
hcDark: null,
hcLight: null
}, nls.localize('terminal.findMatchHighlightBackground', 'Color of the other search matches in the terminal. The color must not be opaque so as not to hide underlying terminal content.'));
}, nls.localize('terminal.findMatchHighlightBackground', 'Color of the other search matches in the terminal. The color must not be opaque so as not to hide underlying terminal content.'), true);
export const TERMINAL_FIND_MATCH_HIGHLIGHT_BORDER_COLOR = registerColor('terminal.findMatchHighlightBorder', {
dark: null,
light: null,
Expand All @@ -113,7 +113,7 @@ export const TERMINAL_DRAG_AND_DROP_BACKGROUND = registerColor('terminal.dropBac
light: EDITOR_DRAG_AND_DROP_BACKGROUND,
hcDark: EDITOR_DRAG_AND_DROP_BACKGROUND,
hcLight: EDITOR_DRAG_AND_DROP_BACKGROUND
}, nls.localize('terminal.dragAndDropBackground', "Background color when dragging on top of terminals. The color should have transparency so that the terminal contents can still shine through."));
}, nls.localize('terminal.dragAndDropBackground', "Background color when dragging on top of terminals. The color should have transparency so that the terminal contents can still shine through."), true);
export const TERMINAL_TAB_ACTIVE_BORDER = registerColor('terminal.tab.activeBorder', {
dark: TAB_ACTIVE_BORDER,
light: TAB_ACTIVE_BORDER,
Expand Down