diff --git a/CHANGELOG.md b/CHANGELOG.md index eda003b1..6037d223 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -69,6 +69,7 @@ - Updated Catppuccin, see #3333 (@SchweGELBin) - Updated gruvbox, see #3372 (@Nicholas42) - Updated GitHub theme, see #3382 (@CosmicHorrorDev) +- Updated ANSI theme to highlight JSON object keys differently from values, see #3413 (@keith-hall) ## `bat` as a library diff --git a/assets/themes.bin b/assets/themes.bin index 080f0d94..c7a0ba99 100644 Binary files a/assets/themes.bin and b/assets/themes.bin differ diff --git a/assets/themes/ansi.tmTheme b/assets/themes/ansi.tmTheme index f103b418..6db89c40 100644 --- a/assets/themes/ansi.tmTheme +++ b/assets/themes/ansi.tmTheme @@ -234,7 +234,7 @@ name Headings scope - markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown + markup.heading punctuation.definition.heading, entity.name.section, markup.heading - text.html.markdown, meta.mapping.key string.quoted.double settings fontStyle diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 75021eb5..1748a3d0 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -2404,6 +2404,24 @@ fn ansi_highlight_underline() { .stderr(""); } +// we don't really test other color schemes in the syntax-tests/source vs highlighted stuff +// so here a simple integration test has been made for the ANSI theme, +// which lives directly inside the bat repository +#[test] +fn ansi_highlight_json_keys() { + bat() + .arg("--paging=never") + .arg("--color=always") + .arg("--decorations=never") + .arg("--theme=ansi") + .arg("--language=json") + .write_stdin("{\"foo\": \"bar\", \"test\": [123, \"baz\"] }") + .assert() + .success() + .stdout("{\x1B[34m\"\x1B[0m\x1B[34mfoo\x1B[0m\x1B[34m\"\x1B[0m: \x1B[32m\"\x1B[0m\x1B[32mbar\x1B[0m\x1B[32m\"\x1B[0m, \x1B[34m\"\x1B[0m\x1B[34mtest\x1B[0m\x1B[34m\"\x1B[0m: [\x1B[33m123\x1B[0m, \x1B[32m\"\x1B[0m\x1B[32mbaz\x1B[0m\x1B[32m\"\x1B[0m] }") + .stderr(""); +} + // Ensure that ANSI passthrough is emitted properly for both wrapping and non-wrapping printer. // See https://github.com/sharkdp/bat/issues/2307 for what common use case this test tests. #[test]