1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 19:02:22 +01:00

Make the default macOS theme depend on Dark Mode (#2197)

* Make the default macOS theme depend on Dark Mode

We frequently get complaints from macOS users that bat does not work on
their default macOS terminal background, which is white.

Pay the price of slightly increased startup time to get a better default
on macOS. To avoid the slightly increased startup time, simply specify a
theme explicitly via `--theme`, `BAT_THEME`, or `~/.config/bat`.

Note that if there is an error when we check if Dark Mode is enabled, we
behave the same as on Windows and Linux; assume that the terminal
background is dark. This harmonizes behavior across platforms, and makes
bat behave the same as before, when Dark Mode was always assumed to be
enabled.

* src/assets.rs: Fix typo

* Update CHANGELOG.md
This commit is contained in:
Martin Nordholts
2022-05-24 19:29:03 +02:00
committed by GitHub
parent e9f8370b13
commit 3339eee2dc
3 changed files with 73 additions and 0 deletions

View File

@@ -1427,6 +1427,8 @@ fn ansi_passthrough_emit() {
fn ignored_suffix_arg() {
bat()
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("test.json~")
.assert()
@@ -1436,6 +1438,8 @@ fn ignored_suffix_arg() {
bat()
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("--ignored-suffix=.suffix")
.arg("test.json.suffix")
@@ -1446,6 +1450,8 @@ fn ignored_suffix_arg() {
bat()
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("test.json.suffix")
.assert()
@@ -1463,6 +1469,8 @@ fn highlighting_is_skipped_on_long_lines() {
bat()
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("longline.json")
.assert()
@@ -1482,6 +1490,8 @@ fn all_global_git_config_locations_syntax_mapping_work() {
bat()
.env("XDG_CONFIG_HOME", fake_home.join(".config").as_os_str())
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("git/.config/git/config")
.assert()
@@ -1492,6 +1502,8 @@ fn all_global_git_config_locations_syntax_mapping_work() {
bat()
.env("HOME", fake_home.as_os_str())
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("git/.config/git/config")
.assert()
@@ -1502,6 +1514,8 @@ fn all_global_git_config_locations_syntax_mapping_work() {
bat()
.env("HOME", fake_home.as_os_str())
.arg("-f")
.arg("--theme")
.arg("Monokai Extended")
.arg("-p")
.arg("git/.gitconfig")
.assert()