Merge pull request #892 from zed-industries/syntax-theme-fixes

Syntax theme fixes
This commit is contained in:
Max Brunsfeld
2022-04-22 13:24:31 -07:00
committed by GitHub
17 changed files with 231 additions and 75 deletions
+12 -18
View File
@@ -37,8 +37,18 @@ export default function editor(theme: Theme) {
};
}
const syntax: any = {};
for (const syntaxKey in theme.syntax) {
const style = theme.syntax[syntaxKey];
syntax[syntaxKey] = {
color: style.color.value,
weight: style.weight.value,
underline: style.underline,
italic: style.italic,
};
}
return {
// textColor: theme.syntax.primary.color,
textColor: theme.syntax.primary.color.value,
background: backgroundColor(theme, 500),
activeLineBackground: theme.editor.line.active.value,
@@ -125,22 +135,6 @@ export default function editor(theme: Theme) {
invalidHintDiagnostic: diagnostic(theme, "muted"),
invalidInformationDiagnostic: diagnostic(theme, "muted"),
invalidWarningDiagnostic: diagnostic(theme, "muted"),
syntax: {
keyword: theme.syntax.keyword.color.value,
function: theme.syntax.function.color.value,
string: theme.syntax.string.color.value,
type: theme.syntax.type.color.value,
number: theme.syntax.number.color.value,
comment: theme.syntax.comment.color.value,
property: theme.syntax.property.color.value,
variant: theme.syntax.variant.color.value,
constant: theme.syntax.constant.color.value,
title: { color: theme.syntax.title.color.value, weight: "bold" },
emphasis: theme.textColor.feature.value,
"emphasis.strong": { color: theme.textColor.feature.value, weight: "bold" },
link_uri: { color: theme.syntax.linkUrl.color.value, underline: true },
link_text: { color: theme.syntax.linkText.color.value, italic: true },
list_marker: theme.syntax.punctuation.color.value,
},
syntax,
};
}
+6 -6
View File
@@ -202,22 +202,22 @@ const syntax: Syntax = {
weight: fontWeights.bold,
},
emphasis: {
color: textColor.active,
color: textColor.feature,
weight: fontWeights.normal,
},
emphasisStrong: {
color: textColor.active,
"emphasis.strong": {
color: textColor.feature,
weight: fontWeights.bold,
},
linkUrl: {
linkUri: {
color: colors.lime[500],
weight: fontWeights.normal,
// TODO: add underline
underline: true,
},
linkText: {
color: colors.orange[500],
weight: fontWeights.normal,
// TODO: add italic
italic: true,
},
};
+6 -6
View File
@@ -200,22 +200,22 @@ const syntax: Syntax = {
weight: fontWeights.bold,
},
emphasis: {
color: textColor.active,
color: textColor.feature,
weight: fontWeights.normal,
},
emphasisStrong: {
color: textColor.active,
"emphasis.strong": {
color: textColor.feature,
weight: fontWeights.bold,
},
linkUrl: {
linkUri: {
color: colors.lime[500],
weight: fontWeights.normal,
// TODO: add underline
underline: true
},
linkText: {
color: colors.red[500],
weight: fontWeights.normal,
// TODO: add italic
italic: true
},
};
+6 -4
View File
@@ -3,7 +3,9 @@ import { withOpacity } from "../utils/color";
export interface SyntaxHighlightStyle {
color: ColorToken;
weight: FontWeightToken;
weight?: FontWeightToken;
underline?: boolean,
italic?: boolean,
}
export interface Player {
@@ -49,12 +51,12 @@ export interface Syntax {
number: SyntaxHighlightStyle;
boolean: SyntaxHighlightStyle;
predictive: SyntaxHighlightStyle;
// TODO: Either move the following or rename
title: SyntaxHighlightStyle;
emphasis: SyntaxHighlightStyle;
emphasisStrong: SyntaxHighlightStyle;
linkUrl: SyntaxHighlightStyle;
linkUri: SyntaxHighlightStyle;
linkText: SyntaxHighlightStyle;
[key: string]: SyntaxHighlightStyle;
};
export default interface Theme {
+1 -1
View File
@@ -17,7 +17,7 @@ type SnakeCased<Type> = {
export default function snakeCaseTree<T>(object: T): SnakeCased<T> {
const snakeObject: any = {};
for (const key in object) {
snakeObject[snakeCase(key)] = snakeCaseValue(object[key]);
snakeObject[snakeCase(key, { keepSpecialCharacters: true })] = snakeCaseValue(object[key]);
}
return snakeObject;
}