-
-
Notifications
You must be signed in to change notification settings - Fork 550
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
Minimal custom themes implementation #330
Minimal custom themes implementation #330
Conversation
The new types are to avoid mangling the current style implementation too much.
For now, custom themes will use constant structs like in Sniffnet's original code. Custom themes will be self contained instead of polluting the original code base. This should make it easier for contributors to modify or add any extra themes without having to change code in too many files.
I implemented a theme to ensure there are no compiliation issues. Floating point math can't be called from a const context, so the themes are returned from a non-const function for now. `iced::color!` is used for ergonomics.
* Support appending extra styles to the settings page AFTER the built in styles. * Make the whole thing scrollable.
Tyvm! |
No problem. Luckily, this PR is very small and easy to maintain. |
`StyleType::Custom` should be serialized to and deserialized from a TOML table. The `toml` crate doesn't seem to figure this out which causes saving and loading the settings to fail. I fixed this by hinting that the type should be a table using serde's attributes.
I've merged #324 🎉 |
I merged in the latest changes. 😺 There weren't many conflicts - just a few imports and updating the code to handle the new |
In terms of extra styles, I'm using bat's implemented themes as a guide. I'll add a few more, but we can figure out which to keep or add later. |
Sounds good. |
ChangesI've generalised the colors for round borders and containers and now it's sufficient to specify their opacity. ImprovementsSome of the palettes required changes to be more aesthetically pleasing in my opinion, particularly Solaraized (Day) because green text wasn't clearly readable. NotesNord theme is amazing. I'm planning to introduce for each Night theme its Day counterpart. The only theme without a bright counterpart would be Dracula. EditFor this PR, I think 8 additional themes are sufficient.
Edit 2It'd be amazing to also get Sniffnet featured on the official pages of the themes we are using |
You covered a lot of the questions I intended to ask today before I asked them. 😂 ImprovementsI'm not great at aesthetics, so you can definitely tweak the styles in any way you see fit. I also like the color gradients a lot! NotesYes, Nord is amazing. I'm pleased with how the style turned out as well. The official Nord site has excellent documentation too which made it easier to implement the style. Also, a lot of programs implement the theme, so you can probably use it for other programs if you want to as well. I added light versions of Gruvbox and Nord. As for Dracula, I'll look into a light style that looks kind of similar. The official Dracula site has an FAQ on whether there will be a light theme - and the answer is "Nope. Dracula can't stand the light." It's clever. 😂 As for featuring Sniffnet on the themes' sites, I think most of them allow you to open a PR or issue to add it. Some themes, like Solarized, don't have an official list or anything. However, solarized is well-known and a lot of people love it. |
That's pretty hilarious, legit.
I'm waiting for the approval from the Dracula team (I sent a request this morning), the other teams repos seem pretty inactive and have lots of requests opened since months... I don't think it's worth to try with them... Btw... I finally understood why highlighted text was not clearly visible. |
Oh yeah, some of the themes don't really publish or update their lists. Dracula, Nord, and Catppuccin seem to keep their lists fairly updated. I have a question about the eight themes. Do you mean eight theme pairs or eight themes total? In other words, does "Nord (Day)" and "Nord (Night)" count as one theme (pair) or two? For Dracula's day theme, I found this edited port which was linked on GitHub. It uses Dracula's colors for a light theme as well. I'll see if I can port it over. |
Eight in total, so we should be done now! |
Thank you very much for your time on Sniffnet 🙏 @all-contributors please add @joshuamegnauth54 for code, design. |
I couldn't determine any contributions to add, did you specify any contributions? I've put up a pull request to add @joshuamegnauth54! 🎉 |
This is a much simpler patch than the last PR. Themes are implemented as plain structs directly in the code. They're automatically added to the settings page after the official themes as well.
I'm opening this as a draft so you can take a look at the code. I'll add 3-5 more themes later, but for now everything works so you can try it or review the source.