Skip to content

Commit 8c92d30

Browse files
committed
Relax color parsing
1 parent e3e9c6e commit 8c92d30

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/vs/editor/common/view/minimapCharRenderer.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ export class MinimapColors {
9191
return new ParsedColor(0, 0, 0);
9292
}
9393
if (color.charCodeAt(0) === CharCode.Hash) {
94-
color = color.substr(1);
94+
color = color.substr(1, 6);
95+
} else {
96+
color = color.substr(0, 6);
9597
}
9698
if (color.length !== 6) {
97-
console.warn('INVALID COLOR: ' + color); // TODO@minimap
9899
return new ParsedColor(0, 0, 0);
99100
}
100101

src/vs/editor/test/common/view/minimapCharRenderer.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ suite('MinimapColors', () => {
2323
test('parseColor', () => {
2424
assertInvalidParseColor(null);
2525
assertInvalidParseColor('');
26-
assertInvalidParseColor('1234567');
2726
assertParseColor('FFFFG0', new ParsedColor(255, 255, 0));
2827
assertParseColor('FFFFg0', new ParsedColor(255, 255, 0));
2928
assertParseColor('-FFF00', new ParsedColor(15, 255, 0));
29+
assertParseColor('0102030', new ParsedColor(1, 2, 3));
3030

3131
assertParseColor('000000', new ParsedColor(0, 0, 0));
3232
assertParseColor('010203', new ParsedColor(1, 2, 3));

0 commit comments

Comments
 (0)