Merge pull request #9589 from qkiroc/style/dark-code

style: 完善amis暗黑主题
This commit is contained in:
hsm-lv 2024-02-29 17:33:59 +08:00 committed by GitHub
commit 76d0811d1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 15 additions and 10 deletions

View File

@ -423,7 +423,7 @@ $Table-strip-bg: transparent;
--Layout-asideLink-onActive-arrowColor: var(
--Layout-asideLink-onActive-color
);
--Layout-asideLink-onActive-color: var(--colors-brand-4);
--Layout-asideLink-onActive-color: var(--colors-brand-6);
--Layout-asideLink-onHover-color: var(--colors-brand-6);
--Layout-asideLink-onHover-iconColor: var(--colors-brand-6);
--Layout-asideLink-onHover-iconSize: var(--sizes-size-9);

View File

@ -24,10 +24,10 @@
padding: var(--gap-md);
border-width: 2px;
border-radius: 2px;
border-color: #eeeeee;
border-color: var(--colors-neutral-line-8);
border-style: dashed;
background-color: #fafafa;
color: #bdbdbd;
background-color: var(--colors-neutral-fill-10);
color: var(--colors-neutral-text-6);
outline: none;
transition: border 0.24s ease-in-out;
}

View File

@ -25,4 +25,10 @@
--button-danger-default-font-color: var(--colors-neutral-text-2);
--button-danger-hover-font-color: var(--colors-neutral-text-2);
--button-danger-active-font-color: var(--colors-neutral-text-2);
--Layout-aside-bg: var(--colors-neutral-fill-10);
--Layout-asideLink-color: var(--colors-neutral-text-2);
--Layout-aside-subList-bg: var(--colors-neutral-fill-10);
--Layout-brand-bg: var(--colors-neutral-fill-10);
--Layout-brand-color: var(--colors-neutral-text-2);
--Layout-asideLink-onActive-color: var(--colors-brand-4);
}

View File

@ -167,7 +167,6 @@ export default class Code extends React.Component<CodeProps> {
static defaultProps: Partial<CodeProps> = {
language: 'plaintext',
editorTheme: 'vs',
tabSize: 4,
wordWrap: true
};
@ -267,12 +266,11 @@ export default class Code extends React.Component<CodeProps> {
return language;
}
/** 注册并返回当前主题名称如果未自定义主题则范围editorTheme值默认为'vs' */
registerAndGetTheme() {
const monaco = this.monaco;
const {editorTheme = 'vs'} = this.props;
let {theme, editorTheme} = this.props;
editorTheme = editorTheme || (theme === 'dark' ? 'vs-dark' : 'vs');
if (!monaco) {
return editorTheme;
}

View File

@ -128,7 +128,7 @@ export interface EditorProps extends FormControlProps {
export default class EditorControl extends React.Component<EditorProps, any> {
static defaultProps: Partial<EditorProps> = {
language: 'javascript',
editorTheme: 'vs',
editorTheme: '',
allowFullscreen: true,
options: {
automaticLayout: true,
@ -285,6 +285,7 @@ export default class EditorControl extends React.Component<EditorProps, any> {
disabled,
options,
editorTheme,
theme,
size,
data,
allowFullscreen,
@ -325,7 +326,7 @@ export default class EditorControl extends React.Component<EditorProps, any> {
onFocus={this.handleFocus}
onBlur={this.handleBlur}
language={language}
editorTheme={editorTheme}
editorTheme={editorTheme || (theme === 'dark' ? 'vs-dark' : 'vs')}
editorDidMount={this.handleEditorMounted}
childProps={{
placeholder: placeholder