mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-15 04:53:22 +00:00
fix(tui): soften syntax colors for calls and builtins
This commit is contained in:
parent
abaabdcb73
commit
50df99a8f3
2 changed files with 37 additions and 5 deletions
|
|
@ -834,6 +834,12 @@ function getSyntaxRules(theme: Theme) {
|
|||
foreground: theme.syntaxFunction,
|
||||
},
|
||||
},
|
||||
{
|
||||
scope: ["function.call", "function.method.call", "function.builtin"],
|
||||
style: {
|
||||
foreground: theme.syntaxFunction,
|
||||
},
|
||||
},
|
||||
{
|
||||
scope: ["keyword"],
|
||||
style: {
|
||||
|
|
@ -860,11 +866,17 @@ function getSyntaxRules(theme: Theme) {
|
|||
},
|
||||
},
|
||||
{
|
||||
scope: ["variable", "variable.parameter", "function.method.call", "function.call"],
|
||||
scope: ["variable"],
|
||||
style: {
|
||||
foreground: theme.syntaxVariable,
|
||||
},
|
||||
},
|
||||
{
|
||||
scope: ["variable.parameter", "variable.builtin", "module.builtin"],
|
||||
style: {
|
||||
foreground: theme.text,
|
||||
},
|
||||
},
|
||||
{
|
||||
scope: ["variable.member", "function", "constructor"],
|
||||
style: {
|
||||
|
|
@ -908,15 +920,21 @@ function getSyntaxRules(theme: Theme) {
|
|||
},
|
||||
},
|
||||
{
|
||||
scope: ["variable.builtin", "type.builtin", "function.builtin", "module.builtin", "constant.builtin"],
|
||||
scope: ["type.builtin"],
|
||||
style: {
|
||||
foreground: theme.error,
|
||||
foreground: theme.syntaxType,
|
||||
},
|
||||
},
|
||||
{
|
||||
scope: ["constant.builtin"],
|
||||
style: {
|
||||
foreground: theme.syntaxNumber,
|
||||
},
|
||||
},
|
||||
{
|
||||
scope: ["variable.super"],
|
||||
style: {
|
||||
foreground: theme.error,
|
||||
foreground: theme.syntaxKeyword,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { expect, test } from "bun:test"
|
||||
|
||||
const { DEFAULT_THEMES, allThemes, addTheme, hasTheme, resolveTheme } = await import(
|
||||
const { DEFAULT_THEMES, allThemes, addTheme, generateSyntax, hasTheme, resolveTheme } = await import(
|
||||
"../../../src/cli/cmd/tui/context/theme"
|
||||
)
|
||||
|
||||
|
|
@ -49,3 +49,17 @@ test("resolveTheme rejects circular color refs", () => {
|
|||
|
||||
expect(() => resolveTheme(item, "dark")).toThrow("Circular color reference")
|
||||
})
|
||||
|
||||
test("generateSyntax maps calls and builtins away from error red", () => {
|
||||
const theme = resolveTheme(DEFAULT_THEMES.opencode, "dark")
|
||||
const syntax = generateSyntax(theme)
|
||||
|
||||
try {
|
||||
expect(syntax.getStyle("function.call")?.fg?.equals(theme.syntaxFunction)).toBe(true)
|
||||
expect(syntax.getStyle("function.builtin")?.fg?.equals(theme.syntaxFunction)).toBe(true)
|
||||
expect(syntax.getStyle("variable.parameter")?.fg?.equals(theme.text)).toBe(true)
|
||||
expect(syntax.getStyle("function.builtin")?.fg?.equals(theme.error)).toBe(false)
|
||||
} finally {
|
||||
syntax.destroy()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue