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

custom theme support #15

Closed
jdx opened this issue Jan 20, 2024 · 4 comments
Closed

custom theme support #15

jdx opened this issue Jan 20, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jdx
Copy link
Owner

jdx commented Jan 20, 2024

No description provided.

@roele
Copy link
Collaborator

roele commented Jan 22, 2024

What do you have in mind here?

By exposing some helper methods for the colors, a custom theme could already be achieved with something like

let theme = Theme {
    cursor: Theme::color_rgb(166, 227, 161),
    selected_prefix: String::from("(*)"),
    unselected_prefix: String::from("( )"),
    ..Default::default()
};

@jdx
Copy link
Owner Author

jdx commented Jan 22, 2024

perhaps just documenting how to do it

@roele
Copy link
Collaborator

roele commented Jan 22, 2024

One thing i find a bit cumbersome is the fact that a theme needs to be cloned when used with multiple inputs. Not sure if thats expensive or generally an accepted pattern in Rust.

let mut theme = Theme::new();

let i = Input::new("What's your e-mail?")
    .description("Please enter your e-mail address.")
    .placeholder("[email protected]")
    .theme(theme.clone());
i.run().expect("error running input");

let c = Confirm::new("Confirm privacy policy")
    .description("Do you accept the privacy policy?")
    .affirmative("Yes")
    .negative("No")
    .theme(theme.clone());
c.run().expect("error running confirm");

@jdx
Copy link
Owner Author

jdx commented Jan 22, 2024

created #22 to address that

@jdx jdx closed this as completed Jan 22, 2024
@roele roele added the enhancement New feature or request label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants