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

Dynamic change theme based on OS appearance #582

Merged
merged 6 commits into from
Sep 24, 2024
Merged

Conversation

casperstorm
Copy link
Member

@casperstorm casperstorm commented Sep 20, 2024

This PR extends theme configuration key to take a light and a dark variant. Doing so will enable a Halloy to dynamically pick theme based on OS appearance.

theme = { light = "ferra-light", dark = "ferra" }

Statically setting a theme, works like before:

theme = "ferra-light"

Copy link
Member

@tarkah tarkah left a comment

Choose a reason for hiding this comment

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

Great stuff! Works on gnome

Comment on lines 33 to 40
pub fn new(first: Theme, second: Option<Theme>) -> Selected {
match second {
Some(second) => Selected::Dynamic {
light: first,
dark: second,
},
None => Selected::Static(first),
}
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Nit: It might be nice to instead have separate constructors: Selected::static vs Selected::dynamic(light: Theme, dark: Theme) and then call-site determines which is used.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixing this before i merge.

@casperstorm casperstorm merged commit 45754d2 into main Sep 24, 2024
1 check passed
@casperstorm casperstorm deleted the feat/light-dark branch September 24, 2024 21:12
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.

Change colorscheme to match desktop preference
2 participants