Skip to content

Commit 958928e

Browse files
authored
fix: improve minimap color theme & problem color theme (#270)
1 parent 07b9a0f commit 958928e

File tree

9 files changed

+102
-25
lines changed

9 files changed

+102
-25
lines changed

src/components/collapse/style.scss

-5
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,8 @@ $collapse__extra: #{$collapse}__extra;
5656
opacity: 0;
5757

5858
#{$actionBar}__label.codicon {
59-
color: var(--activityBar-inactiveForeground);
6059
height: inherit;
6160
line-height: inherit;
62-
63-
&:hover {
64-
color: var(--activityBar-activeBorder);
65-
}
6661
}
6762
}
6863

src/components/tree/style.scss

+1-5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ $switch: #{$rcTree}-switcher;
3333
margin: 0;
3434
padding: 0 0 0 18px;
3535
}
36+
3637
span#{$switch} {
3738
background-attachment: scroll;
3839
background-color: transparent;
@@ -65,11 +66,6 @@ $switch: #{$rcTree}-switcher;
6566
cursor: not-allowed;
6667
}
6768
}
68-
69-
&-selected {
70-
background: var(--list-activeSelectionBackground);
71-
border-color: var(--list-focusOutline);
72-
}
7369
}
7470

7571
&-node-content-wrapper {

src/extensions/theme-defaults/themes/dark_defaults.json

+6
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,18 @@
2727
"inputValidation.errorBackground": "#5A1D1D",
2828
"inputValidation.errorBorder": "#BE1100",
2929
"icon.foreground": "#C5C5C5",
30+
"problemsWarningIcon.foreground": "#CCA700",
31+
"problemsErrorIcon.foreground": "#F48771",
32+
"problemsInfoIcon.foreground": "#75BEFF",
3033
"settings.textInputBackground": "#292929",
3134
"settings.numberInputBackground": "#292929",
3235
"menu.background": "#252526",
3336
"menu.foreground": "#CCCCCC",
3437
"menu.selectionBackground": "#094771",
3538
"menu.separatorBackground": "#BBBBBB",
39+
"minimapSlider.background": "#79797980",
40+
"minimapSlider.hoverBackground": "#64646480",
41+
"minimapSlider.activeBackground": "#bfbfbf66",
3642
"statusBarItem.remoteForeground": "#FFF",
3743
"statusBarItem.remoteBackground": "#16825D",
3844
"sidebarSectionHeader.background": "#0000",

src/extensions/theme-defaults/themes/light_defaults.json

+6
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
"inputValidation.errorBackground": "#F2DEDE",
2828
"inputValidation.errorBorder": "#BE1100",
2929
"icon.foreground": "#424242",
30+
"problemsWarningIcon.foreground": "#BF8803",
31+
"problemsErrorIcon.foreground": "#E51400",
32+
"problemsInfoIcon.foreground": "#75BEFF",
3033
"searchEditor.textInputBorder": "#CECECE",
3134
"diffEditor.insertedTextBackground": "#9bb95533",
3235
"diffEditor.removedTextBackground": "#ff000033",
@@ -39,6 +42,9 @@
3942
"tab.border": "#f3f3f3",
4043
"menu.selectionBackground": "#0060C0",
4144
"menu.separatorBackground": "#888888",
45+
"minimapSlider.background": "#64646480",
46+
"minimapSlider.hoverBackground": "#64646480",
47+
"minimapSlider.activeBackground": "#00000099",
4248
"tab.inactiveBackground": "rgb(236, 236, 236)",
4349
"tab.inactiveForeground": "rgba(51, 51, 51, 0.7)",
4450
"tab.activeBackground": "#fffffe",

src/style/theme/tree.scss

+6-1
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,16 @@
2929
}
3030

3131
.rc-tree-treenode-selected {
32-
background: var(--button-background);
32+
background: var(--list-activeSelectionBackground);
33+
border-color: var(--list-focusOutline);
3334

3435
.rc-tree-node-content-wrapper {
3536
color: var(--list-activeSelectionForeground);
3637
}
38+
39+
.rc-tree-switcher {
40+
color: var(--list-activeSelectionForeground);
41+
}
3742
}
3843

3944
input {

src/workbench/editor/style.scss

-4
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,6 @@
4242
justify-content: center;
4343
padding: 0 8px 0 4px;
4444

45-
&:not(#{$editor}__group-actions-item--disabled):hover {
46-
color: var(--activityBar-activeBorder);
47-
}
48-
4945
&--disabled {
5046
cursor: default;
5147
opacity: 0.4;

src/workbench/problems/paneView/index.tsx

+24-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as React from 'react';
22
import { getBEMElement, prefixClaName } from 'mo/common/className';
33
import TreeView from 'mo/components/tree';
44
import { localize } from 'mo/i18n/localize';
5-
import { Scrollable } from 'mo/components';
5+
import { Icon, Scrollable } from 'mo/components';
6+
import { IProblems, MarkerSeverity } from 'mo/model';
67

78
const defaultClassName = prefixClaName('problems');
89
const treeClassName = getBEMElement(defaultClassName, 'treeview');
@@ -11,9 +12,9 @@ const treeNodeBadgeClassName = getBEMElement(treeNodeClassName, 'badge');
1112
const treeLeafClassName = getBEMElement(treeClassName, 'treeLeaf');
1213
const treeLeafSubInfoClassName = getBEMElement(treeLeafClassName, 'subInfo');
1314

14-
function ProblemsPaneView(props: any) {
15+
function ProblemsPaneView(props: IProblems) {
1516
const { data } = props;
16-
if (!data?.length)
17+
if (!data?.length) {
1718
return (
1819
<div style={{ margin: '0 18px', userSelect: 'none' }}>
1920
{localize(
@@ -22,6 +23,24 @@ function ProblemsPaneView(props: any) {
2223
)}
2324
</div>
2425
);
26+
}
27+
28+
const getIcon = (status: number) => {
29+
switch (status) {
30+
case MarkerSeverity.Error: {
31+
return <Icon type="error" />;
32+
}
33+
case MarkerSeverity.Warning: {
34+
return <Icon type="warning" />;
35+
}
36+
case MarkerSeverity.Info: {
37+
return <Icon type="info" />;
38+
}
39+
default: {
40+
return '';
41+
}
42+
}
43+
};
2544

2645
return (
2746
<Scrollable>
@@ -39,7 +58,8 @@ function ProblemsPaneView(props: any) {
3958
</span>
4059
) : (
4160
<span className={treeLeafClassName}>
42-
{value.message}
61+
{getIcon(value.status)}
62+
<span>{value.message}</span>
4363
<span className={treeLeafSubInfoClassName}>
4464
{value.code}
4565
</span>

src/workbench/problems/style.scss

+31-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import 'mo/style/common';
22

3-
$badge-size: 18px;
3+
$badge-size: 11px;
44

55
#{$problems} {
66
margin: 0 18px;
@@ -12,21 +12,46 @@ $badge-size: 18px;
1212

1313
&__badge {
1414
background: var(--badge-background);
15-
border-radius: 50%;
15+
border-radius: $badge-size;
16+
box-sizing: border-box;
1617
color: var(--badge-foreground);
1718
display: inline-block;
18-
height: $badge-size;
19+
font-size: $badge-size;
20+
font-weight: 400;
1921
line-height: $badge-size;
2022
margin-left: 10px;
23+
min-height: 18px;
24+
min-width: 18px;
25+
padding: 3px 6px;
2126
text-align: center;
22-
width: $badge-size;
27+
}
28+
}
29+
30+
#{$rcTree}-treenode:not(#{$rcTree}-treenode-selected) {
31+
.codicon-info {
32+
color: var(--problemsInfoIcon-foreground);
33+
}
34+
35+
.codicon-warning {
36+
color: var(--problemsWarningIcon-foreground);
37+
}
38+
39+
.codicon-error {
40+
color: var(--problemsErrorIcon-foreground);
2341
}
2442
}
2543

2644
&__treeLeaf {
45+
align-items: center;
46+
display: flex;
47+
48+
.codicon {
49+
margin-right: 6px;
50+
}
51+
2752
&__subInfo {
28-
color: var(--activityBar-inactiveForeground);
29-
margin-left: 5px;
53+
margin-left: 6px;
54+
opacity: 0.7;
3055
}
3156
}
3257
}

stories/extensions/problems/index.tsx

+28
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,34 @@ function init() {
2626
startColumn: 1,
2727
endLineNumber: 0,
2828
endColumn: 1,
29+
status: 8,
30+
},
31+
children: [],
32+
},
33+
{
34+
id: 4,
35+
name: '0-1',
36+
value: {
37+
code: 'endLineNumber',
38+
message: '解析可能会存在问题',
39+
startLineNumber: 0,
40+
startColumn: 1,
41+
endLineNumber: 0,
42+
endColumn: 1,
43+
status: 4,
44+
},
45+
children: [],
46+
},
47+
{
48+
id: 5,
49+
name: '0-1',
50+
value: {
51+
code: 'endLineNumber',
52+
message: '住在山里,真不戳',
53+
startLineNumber: 0,
54+
startColumn: 1,
55+
endLineNumber: 0,
56+
endColumn: 1,
2957
status: 2,
3058
},
3159
children: [],

0 commit comments

Comments
 (0)