Skip to content

Commit 04e1d59

Browse files
committed
supply alternate default colors for MCFLY_LIGHT
1 parent e159fde commit 04e1d59

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
McFly replaces your default `ctrl-r` shell history search with an intelligent search engine that takes into account
99
your working directory and the context of recently executed commands. McFly's suggestions are prioritized
1010
in real time with a small neural network.
11-
11+
1212
TL;DR: an upgraded `ctrl-r` where history results make sense for what you're working on right now.
1313

1414
## Features
@@ -166,10 +166,13 @@ To avoid McFly's UI messing up your scrollback history in iTerm2, make sure this
166166
<img src="/docs/iterm2.jpeg" alt="iterm2 UI instructions">
167167
168168
## Settings
169-
A number of settings can be set via environment variables. To set a setting you should add the following snippets to your `~/.bashrc` / `~/.zshrc` / `~/.config/fish/config.fish`.
169+
170+
Settings, in particular the interface colors, may be configured in [`~/.mcfly/mcfly.toml`](https://github.com/cantino/mcfly/blob/crossterm-and-colors/mcfly.example.toml).
171+
172+
A number of settings can also be set via environment variables. To set a setting you should add the following snippets to your `~/.bashrc` / `~/.zshrc` / `~/.config/fish/config.fish`.
170173
171174
### Light Mode
172-
To swap the color scheme for use in a light terminal, set the environment variable `MCFLY_LIGHT`.
175+
To swap the default color scheme for use in a light terminal, set the environment variable `MCFLY_LIGHT`.
173176
174177
bash / zsh:
175178
```bash

src/settings.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,25 @@ impl Settings {
258258
)
259259
.get_matches();
260260

261-
let mut settings: Settings = Figment::from(Serialized::defaults(Settings::default()))
261+
let mut default_settings = Settings::default();
262+
263+
if env::var("MCFLY_LIGHT").is_ok() {
264+
default_settings.colors = Colors {
265+
menu_bg: "Blue".to_string(),
266+
menu_fg: "White".to_string(),
267+
menu_deleting_bg: "Red".to_string(),
268+
menu_deleting_fg: "Cyan".to_string(),
269+
bg: "White".to_string(),
270+
fg: "Black".to_string(),
271+
prompt_fg: "Black".to_string(),
272+
highlight: "Blue".to_string(),
273+
cursor_bg: "Dark_Grey".to_string(),
274+
cursor_fg: "White".to_string(),
275+
cursor_highlight: "White".to_string(),
276+
};
277+
}
278+
279+
let mut settings: Settings = Figment::from(Serialized::defaults(default_settings))
262280
.merge(Toml::file(Settings::mcfly_config_path()))
263281
.extract()
264282
.unwrap();

0 commit comments

Comments
 (0)