Skip to content

feat: separate light and dark themes #378

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ac615223s5
Copy link
Contributor

closes #368
closes #299
closes #289

@ac615223s5 ac615223s5 changed the title Separate light and dark themes feat: separate light and dark themes Feb 12, 2025
@Tech-How
Copy link

Tech-How commented Apr 5, 2025

Will this be merged soon? I'm excited for it!

Copy link
Member

@sigaloid sigaloid left a comment

Choose a reason for hiding this comment

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

Preliminary glance-over review here, may do some more testing + reviewing before merge

src/utils.rs Outdated
Comment on lines 630 to 634
pub theme: String,
pub theme_light: String,
#[revision(start = 1)]
pub theme_dark: String,
Copy link
Member

@sigaloid sigaloid Apr 6, 2025

Choose a reason for hiding this comment

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

I'm using the revision library here to specifically allow for reverse compatibility of parsed Preferences (that's the test that is currently failing). Try leaving theme but making its derive tag #[revision(start = 1, end = 2)], then the new light and dark ones #[revision(start = 2)] (and changing revision to 2 at the top of the Preferences struct). Once you get the tests passing, go to Redlib in an incognito browser and export a new Preferences string (with a revision of 2) and add it to the KNOWN_GOOD_CONFIGS array.

src/config.rs Outdated
Comment on lines 27 to 29
#[serde(rename = "REDLIB_DEFAULT_THEME")]
#[serde(alias = "LIBREDDIT_DEFAULT_THEME")]
pub(crate) default_theme: Option<String>,
Copy link
Member

Choose a reason for hiding this comment

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

Is there any way we can preserve this behavior so someone with the REDLIB_DEFAULT_THEME env var set doesn't have to change it? Possibly by giving default_theme_light and default_theme_dark an alias of REDLIB_DEFAULT_THEME in order to make it the default across both?

@ac615223s5
Copy link
Contributor Author

ac615223s5 commented Apr 11, 2025

I made the changes but it doesn't compile anymore (error[E0560]: struct Preferences has no field named theme --> src\utils.rs:630:2 .
sorry, not familiar with that library. does anyone knew how to fix this?

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