M2.2: PHP highlighting, syntax colour tokens and editor.reveal
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f13a49064d
commit
6c75c08d70
25 changed files with 1044 additions and 33 deletions
|
|
@ -44,6 +44,24 @@ const COMMON: &[(&str, &str)] = &[
|
|||
("font-size-editor", "14px"),
|
||||
];
|
||||
|
||||
/// Syntax token names (`--lt-syntax-<name>`) every theme defines. The
|
||||
/// editor's highlighter reads only these; each reaches 4.5:1 on the editor
|
||||
/// background (`ui/tests/theme/contrast.test.ts`). The colours are Lutra's
|
||||
/// own, derived from the theme's copper accent and warm neutrals.
|
||||
pub const SYNTAX_TOKENS: &[&str] = &[
|
||||
"keyword",
|
||||
"string",
|
||||
"number",
|
||||
"comment",
|
||||
"variable",
|
||||
"function",
|
||||
"type",
|
||||
"constant",
|
||||
"tag",
|
||||
"attribute",
|
||||
"operator",
|
||||
];
|
||||
|
||||
/// The default dark theme.
|
||||
pub const DARK: Theme = Theme {
|
||||
id: "lutra-dark",
|
||||
|
|
@ -68,6 +86,17 @@ pub const DARK: Theme = Theme {
|
|||
("tab-active-bg", "#191817"),
|
||||
("tab-modified", "#d39a5c"),
|
||||
("notice-bg", "#3a3025"),
|
||||
("syntax-keyword", "#d39a5c"),
|
||||
("syntax-string", "#a9bd7e"),
|
||||
("syntax-number", "#e3a1a8"),
|
||||
("syntax-comment", "#958d84"),
|
||||
("syntax-variable", "#d8bba6"),
|
||||
("syntax-function", "#e6c46f"),
|
||||
("syntax-type", "#7fbac6"),
|
||||
("syntax-constant", "#c4a0d6"),
|
||||
("syntax-tag", "#e08b70"),
|
||||
("syntax-attribute", "#cdb87e"),
|
||||
("syntax-operator", "#b8afa6"),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
@ -95,6 +124,17 @@ pub const LIGHT: Theme = Theme {
|
|||
("tab-active-bg", "#fbfaf8"),
|
||||
("tab-modified", "#965a22"),
|
||||
("notice-bg", "#e9dfd4"),
|
||||
("syntax-keyword", "#965a22"),
|
||||
("syntax-string", "#4e6a24"),
|
||||
("syntax-number", "#a03a4e"),
|
||||
("syntax-comment", "#6e665e"),
|
||||
("syntax-variable", "#7f4a34"),
|
||||
("syntax-function", "#7a5808"),
|
||||
("syntax-type", "#24697a"),
|
||||
("syntax-constant", "#73479a"),
|
||||
("syntax-tag", "#a5432a"),
|
||||
("syntax-attribute", "#695d1a"),
|
||||
("syntax-operator", "#5a5149"),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
@ -226,6 +266,20 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn themes_define_the_syntax_tokens() {
|
||||
for theme in BUILTIN {
|
||||
let tokens = token_map(theme);
|
||||
for name in SYNTAX_TOKENS {
|
||||
assert!(
|
||||
tokens.contains_key(&format!("--lt-syntax-{name}")),
|
||||
"{} lacks syntax-{name}",
|
||||
theme.id
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolves_settings() {
|
||||
assert_eq!(resolve("lutra-light", Some(true)), LIGHT);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue