Skip to content

Conversation

@wetfloo
Copy link
Contributor

@wetfloo wetfloo commented Jan 10, 2025

Description

This adds the ability to detect terminal colors when hyfetch is invoked, thereby adapting its theme

Relevant Links

This partially resolves my issue

Screenshots

Screen.Recording.2025-01-10.at.23.06.14.mov

My new config

{
    "preset": "transgender",
    "mode": "rgb",
    "auto_detect_light_dark": true,
    "lightness": 0.65,
    "color_align": {
        "mode": "horizontal"
    },
    "backend": "fastfetch",
    "args": null,
    "distro": null,
    "pride_month_disable": false
}

If I have to write this in python, I'll scream (and then figure it out anyway)

@hykilpikonna
Copy link
Owner

Uhhh changes are good but please don't reformat the codebase 😭

Comment on lines 39 to 44
impl Default for TerminalTheme {
fn default() -> Self {
Self::Light
}
}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think dark terminals are more popular so maybe setting this default to dark would be better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, I'll change that

@wetfloo
Copy link
Contributor Author

wetfloo commented Jan 19, 2025

Uhhh changes are good but please don't reformat the codebase 😭

sorry cargo fmt just kinda does that...

@hykilpikonna hykilpikonna merged commit 0cc6ddb into hykilpikonna:master Feb 16, 2025
1 check passed
@hykilpikonna
Copy link
Owner

Thanks, can confirm that it works!

image

.help("Ask for input before exiting")
.switch()
.hide();
let auto_detect_light_dark = long("auto-detect-light-dark")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in the wrong section (Note the comment above: "hidden")

.hide();
let auto_detect_light_dark = long("auto-detect-light-dark")
.help("Enables hyfetch to detect light/dark terminal background in runtime")
.argument("BOOL")
Copy link
Contributor

@teohhanhui teohhanhui Feb 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be something like "AUTO_DETECT_BG"

https://docs.rs/bpaf/latest/bpaf/parsers/struct.NamedArg.html#method.argument

For metavar value you should pick something short and descriptive about the parameter, usually in capital letters. For example for an abstract file parameter it could be "FILE", for a username - "USER", etc.

// hidden
test_print,
ask_exit,
auto_detect_light_dark,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here... Wrong section.

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.

Support system light/dark mode

3 participants