Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow colors to be configured via config file #405

Merged
merged 1 commit into from
May 2, 2024

Conversation

exokernel
Copy link
Contributor

What?

Allow the colors to be configured via ~/.config/mcfly/config.toml. This can also serve as a starting point for other config options. It has settings for both dark-mode and light-mode colors.

Example (my current color config for dark background):

[colors]

[colors.menubar]
bg = "black"
fg = "red"

[colors.darkmode]
prompt = "cyan"
timing = "yellow"
results_selection_fg = "cyan"
results_selection_bg = "black"
results_selection_hl = "red"

Why?

I love mcfly but the default colors aren't working for me. I thought it might be nice if they could be set in a config file. This adds that capability by reading a basic colors config in a ~/.config file for mcfly. It's written such that any errors or missing config will silently just fall back to using the defaults, which I've kept the same.

Caveats

Reads the config file each time mcfly is run so that does add some overhead. An alternative might be to have different hard-coded color modes that could be enabled by a command line flag. This would mean no file read but also that you'd be limited to the set of color modes that are supported. The Colors struct used in the project seems pretty limited to begin with though (i.e. there's not a huge number of options). Some colors also didn't work for me in some contexts (e.g. setting the menubar to certain colors didn't always work for me).

Thoughts and Feedback

Please let me know if you have thoughts on better ways to do this, if you'd like to see more extensive testing, etc.

@cantino
Copy link
Owner

cantino commented Apr 28, 2024

Thank you for this PR. Making a few changes in #407

@cantino cantino merged commit 853c097 into cantino:master May 2, 2024
5 of 27 checks passed
@cantino
Copy link
Owner

cantino commented May 2, 2024

Merged in #407, thanks @exokernel!

@cantino
Copy link
Owner

cantino commented May 11, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants