Allow colors to be configured via config file #405
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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):
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.