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

Proposal: Allow dynamic themes via JSON templates #211

Closed
pbarnum opened this issue Apr 6, 2019 · 9 comments
Closed

Proposal: Allow dynamic themes via JSON templates #211

pbarnum opened this issue Apr 6, 2019 · 9 comments
Assignees
Labels
enhancement New feature or request Hacktoberfest

Comments

@pbarnum
Copy link
Contributor

pbarnum commented Apr 6, 2019

It would be nice to be able to load and run custom themes during runtime.

  • The app's main theme must still be written in Go and compiled with the app.
  • New themes must follow strict guidelines in order to be a valid and usable theme.
  • A app's theme should run after successfully loading.
  • The app can handle multiple themes
    • This would require a menu system to switch between themes. Though this might be needed anyway if a user wanted to switch back to default after loading a custom theme.
@andydotxyz
Copy link
Member

I like this proposal.
Theme loading is probably out of scope for the 1.1 release but if someone contributed some solid code we would probably accept it.

Part of the conversation may be about the actual storage format. JSON and XML are easy from a Go point of view but are they right for people who will edit the themes?

It may also relate to the settings discussion.

@andydotxyz andydotxyz added the enhancement New feature or request label Apr 7, 2019
@andydotxyz andydotxyz added this to To do in Full Framework via automation Apr 7, 2019
@pbarnum
Copy link
Contributor Author

pbarnum commented Apr 7, 2019

Good point. I agree that JSON and XML are easy to work with and provide a simple and familiar interface, but it could get out of hand depending on a few factors:

  • Number of customizations
  • Level of detail within customizations
  • Relationships between customizations
  • Versioning

Perhaps a look into how other applications handle custom theming could answer some questions. VSCode comes to mind as does Sublime Text.

@asciifaceman
Copy link
Contributor

asciifaceman commented May 27, 2019

VSCode uses json defined overrides of sane defaults, likely with a right to left merge somewhere in the line (for configuration). As well as actual css etc - but this is a product of the fact that VSCode is written in electron

It may be useful to deal with theme file sprawl by allowing users to load them in a compressed or condensed format, say a zip or some format that allows bundling of files into one.

@andydotxyz
Copy link
Member

Depending on whether or not we change how themes work I don't think this needs to be multiple files.
Unless you include the icon assets too...

@pbarnum
Copy link
Contributor Author

pbarnum commented May 28, 2019

That gets into assets/ territory where these should be loaded separately IMO. Assets could follow a set scheme declared in the code, something like assets/framework/right_border.png or assets/icons/home.png

@andydotxyz
Copy link
Member

Given that we have started using TOML for the FyneApp.toml build metadata, I wonder if we should do the same here.
It could be the same file even, but that seems less wise as an app may want to switch themes.

@andydotxyz
Copy link
Member

This is now on develop

Full Framework automation moved this from In progress to Done Oct 22, 2021
@pbarnum
Copy link
Contributor Author

pbarnum commented Oct 22, 2021

Amazing! Thanks for all your hard work @andydotxyz

@andydotxyz
Copy link
Member

Thanks :) there is still work to be done as icon and font resources cannot yet be specified via JSON, but it should be added soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest
Projects
Development

No branches or pull requests

3 participants