Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve minimap color theme & problem color theme #270

Merged
merged 1 commit into from
Jul 28, 2021
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
5 changes: 0 additions & 5 deletions src/components/collapse/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,8 @@ $collapse__extra: #{$collapse}__extra;
opacity: 0;

#{$actionBar}__label.codicon {
color: var(--activityBar-inactiveForeground);
height: inherit;
line-height: inherit;

&:hover {
color: var(--activityBar-activeBorder);
}
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/components/tree/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $switch: #{$rcTree}-switcher;
margin: 0;
padding: 0 0 0 18px;
}

span#{$switch} {
background-attachment: scroll;
background-color: transparent;
Expand Down Expand Up @@ -65,11 +66,6 @@ $switch: #{$rcTree}-switcher;
cursor: not-allowed;
}
}

&-selected {
background: var(--list-activeSelectionBackground);
border-color: var(--list-focusOutline);
}
}

&-node-content-wrapper {
Expand Down
6 changes: 6 additions & 0 deletions src/extensions/theme-defaults/themes/dark_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,18 @@
"inputValidation.errorBackground": "#5A1D1D",
"inputValidation.errorBorder": "#BE1100",
"icon.foreground": "#C5C5C5",
"problemsWarningIcon.foreground": "#CCA700",
"problemsErrorIcon.foreground": "#F48771",
"problemsInfoIcon.foreground": "#75BEFF",
"settings.textInputBackground": "#292929",
"settings.numberInputBackground": "#292929",
"menu.background": "#252526",
"menu.foreground": "#CCCCCC",
"menu.selectionBackground": "#094771",
"menu.separatorBackground": "#BBBBBB",
"minimapSlider.background": "#79797980",
"minimapSlider.hoverBackground": "#64646480",
"minimapSlider.activeBackground": "#bfbfbf66",
"statusBarItem.remoteForeground": "#FFF",
"statusBarItem.remoteBackground": "#16825D",
"sidebarSectionHeader.background": "#0000",
Expand Down
6 changes: 6 additions & 0 deletions src/extensions/theme-defaults/themes/light_defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
"inputValidation.errorBackground": "#F2DEDE",
"inputValidation.errorBorder": "#BE1100",
"icon.foreground": "#424242",
"problemsWarningIcon.foreground": "#BF8803",
"problemsErrorIcon.foreground": "#E51400",
"problemsInfoIcon.foreground": "#75BEFF",
"searchEditor.textInputBorder": "#CECECE",
"diffEditor.insertedTextBackground": "#9bb95533",
"diffEditor.removedTextBackground": "#ff000033",
Expand All @@ -39,6 +42,9 @@
"tab.border": "#f3f3f3",
"menu.selectionBackground": "#0060C0",
"menu.separatorBackground": "#888888",
"minimapSlider.background": "#64646480",
Copy link
Collaborator

Choose a reason for hiding this comment

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

miniMap 目前来看,应该是根据 theme 切换,这个值有动态变化的一个过程的

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

目前是有变化的,可以切当前 PR 的分支看看,不过只设置了 dark_defaultslight_defaults

"minimapSlider.hoverBackground": "#64646480",
"minimapSlider.activeBackground": "#00000099",
"tab.inactiveBackground": "rgb(236, 236, 236)",
"tab.inactiveForeground": "rgba(51, 51, 51, 0.7)",
"tab.activeBackground": "#fffffe",
Expand Down
7 changes: 6 additions & 1 deletion src/style/theme/tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@
}

.rc-tree-treenode-selected {
background: var(--button-background);
background: var(--list-activeSelectionBackground);
border-color: var(--list-focusOutline);

.rc-tree-node-content-wrapper {
color: var(--list-activeSelectionForeground);
}

.rc-tree-switcher {
color: var(--list-activeSelectionForeground);
}
}

input {
Expand Down
4 changes: 0 additions & 4 deletions src/workbench/editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
justify-content: center;
padding: 0 8px 0 4px;

&:not(#{$editor}__group-actions-item--disabled):hover {
color: var(--activityBar-activeBorder);
}

&--disabled {
cursor: default;
opacity: 0.4;
Expand Down
28 changes: 24 additions & 4 deletions src/workbench/problems/paneView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import { getBEMElement, prefixClaName } from 'mo/common/className';
import TreeView from 'mo/components/tree';
import { localize } from 'mo/i18n/localize';
import { Scrollable } from 'mo/components';
import { Icon, Scrollable } from 'mo/components';
import { IProblems, MarkerSeverity } from 'mo/model';

const defaultClassName = prefixClaName('problems');
const treeClassName = getBEMElement(defaultClassName, 'treeview');
Expand All @@ -11,9 +12,9 @@ const treeNodeBadgeClassName = getBEMElement(treeNodeClassName, 'badge');
const treeLeafClassName = getBEMElement(treeClassName, 'treeLeaf');
const treeLeafSubInfoClassName = getBEMElement(treeLeafClassName, 'subInfo');

function ProblemsPaneView(props: any) {
function ProblemsPaneView(props: IProblems) {
const { data } = props;
if (!data?.length)
if (!data?.length) {
return (
<div style={{ margin: '0 18px', userSelect: 'none' }}>
{localize(
Expand All @@ -22,6 +23,24 @@ function ProblemsPaneView(props: any) {
)}
</div>
);
}

const getIcon = (status: number) => {
switch (status) {
case MarkerSeverity.Error: {
return <Icon type="error" />;
}
case MarkerSeverity.Warning: {
return <Icon type="warning" />;
}
case MarkerSeverity.Info: {
return <Icon type="info" />;
}
default: {
return '';
}
}
};

return (
<Scrollable>
Expand All @@ -39,7 +58,8 @@ function ProblemsPaneView(props: any) {
</span>
) : (
<span className={treeLeafClassName}>
{value.message}
{getIcon(value.status)}
<span>{value.message}</span>
<span className={treeLeafSubInfoClassName}>
{value.code}
</span>
Expand Down
37 changes: 31 additions & 6 deletions src/workbench/problems/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import 'mo/style/common';

$badge-size: 18px;
$badge-size: 11px;

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

&__badge {
background: var(--badge-background);
border-radius: 50%;
border-radius: $badge-size;
box-sizing: border-box;
color: var(--badge-foreground);
display: inline-block;
height: $badge-size;
font-size: $badge-size;
font-weight: 400;
line-height: $badge-size;
margin-left: 10px;
min-height: 18px;
min-width: 18px;
padding: 3px 6px;
text-align: center;
width: $badge-size;
}
}

#{$rcTree}-treenode:not(#{$rcTree}-treenode-selected) {
.codicon-info {
color: var(--problemsInfoIcon-foreground);
}

.codicon-warning {
color: var(--problemsWarningIcon-foreground);
}

.codicon-error {
color: var(--problemsErrorIcon-foreground);
}
}

&__treeLeaf {
align-items: center;
display: flex;

.codicon {
margin-right: 6px;
}

&__subInfo {
color: var(--activityBar-inactiveForeground);
margin-left: 5px;
margin-left: 6px;
opacity: 0.7;
}
}
}
Expand Down
28 changes: 28 additions & 0 deletions stories/extensions/problems/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,34 @@ function init() {
startColumn: 1,
endLineNumber: 0,
endColumn: 1,
status: 8,
},
children: [],
},
{
id: 4,
name: '0-1',
value: {
code: 'endLineNumber',
message: '解析可能会存在问题',
startLineNumber: 0,
startColumn: 1,
endLineNumber: 0,
endColumn: 1,
status: 4,
},
children: [],
},
{
id: 5,
name: '0-1',
value: {
code: 'endLineNumber',
message: '住在山里,真不戳',
startLineNumber: 0,
startColumn: 1,
endLineNumber: 0,
endColumn: 1,
status: 2,
},
children: [],
Expand Down