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

Allow custom UI themes #15394

Merged
merged 8 commits into from
Feb 17, 2022
Merged

Allow custom UI themes #15394

merged 8 commits into from
Feb 17, 2022

Conversation

iota97
Copy link
Contributor

@iota97 iota97 commented Feb 11, 2022

This allow to add other color themes to themes folder, might add a few to assets later if I manage to make something decent :)

Silly example:
Screenshot_2022-02-11_12-31-28

I made one of the worst looking HTML page ever to help creating theme, uploaded the source here. Will improve it as well.

@hrydgard
Copy link
Owner

hrydgard commented Feb 11, 2022

I've actually been thinking about an easier way to do this, which would be simply a hue and a saturation slider, then we could rotate the colors in the vertex shader when drawing the UI very cheaply. Would also be less code (though slightly less flexible since you then couldn't set the focused and unfocused colors entirely separately, etc).

Could even then drive that slider from the month to get the original PSP's seasonally changing background colors, as an option, heh.

@iota97
Copy link
Contributor Author

iota97 commented Feb 11, 2022

That would be quite a fancy thing, I didn't thought of it. Will take a look into it :)

@hrydgard
Copy link
Owner

Actually I can take care of that, kind of wanted that feature for a while. And the sum total of the changes will probably actually be larger, come to think of it. Let's see :)

@iota97
Copy link
Contributor Author

iota97 commented Feb 11, 2022

Well was trying to toy around as I had some spare time: https://github.com/iota97/ppsspp/tree/vertex-hue

Vulkan work fine, OpenGL can't seem to get the uniform to the shader.

Edit:
I wonder if it is worth it to do in the shader:

  • With a Hue/Saturation we have no way to change lightness of colors (let's say have a dark foreground and a light background rather than viceversa).
  • I'm not sure how much a hue slider is user friendly (if we can update while we slide is fine), if not we will probably end up with a few presets.
  • Presets can be make anyway with "themes folder way".
  • Changing the rendering feel more risky of breakage (also more testing needed for different device/API).

@hrydgard
Copy link
Owner

Ah nice. I can take it from there.

@hrydgard
Copy link
Owner

Hm, some good points there, yeah. Really like the slider though :P And some extra vertex shader work in the UI should be no big deal and hopefully not much cause for breaks...

@hrydgard
Copy link
Owner

hrydgard commented Feb 11, 2022

I made an alternate branch that gets it working on all backends, and has live slider update:

https://github.com/hrydgard/ppsspp/tree/ui-tint-saturate

diff: fac0868

But yeah, it won't support switching bright and dark, and that kind of thing. In a way, I'm not sure that's a bad thing... Kinda keeps the "PPSSPP look" intact while still allowing some customization.

Not sure what is best.

UI/UI.vcxproj Outdated Show resolved Hide resolved
UI/Theme.cpp Outdated Show resolved Hide resolved
UI/Theme.cpp Outdated Show resolved Hide resolved
#include "Core/System.h"

struct themeInfo {
std::string name;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like it'd be really nice (maybe not in this pull) to also allow overriding the main zim (if not the font) per theme. Since we read all the metadata from there, this would allow customizing icons, etc.

It might also be nice to have a default ini in the repo or somewhere that has the default theme (but also like you have, still work without it.)

-[Unknown]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ZIM override would allow for custom touch controls too that got requested quite a few times.

Mhhhh, I got the feeling this the way to go rather than hue shift (kinda fancier with the slider but that's it).

Copy link
Owner

Choose a reason for hiding this comment

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

Now I kinda feel .. why not both? You pick a theme, and then you can shift it if you don't like its colors.. Maybe it's overkill.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Such use cases could be covered by a web app to create or edit themes. We could also change the lightness value without changing the image redering as it happens on the vertex stage.
We could get the web interface make the ZIM file in the future too or thing like this to make it easier for the user.

But we could have both in the end, never disliked overkills in software to begin with :P

Copy link
Collaborator

Choose a reason for hiding this comment

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

I do think both is not unreasonable - although I'm just very slightly concerned about Mali-400 or something dying from more complex shaders (don't pay attention, I just have paranoia from all the reported shader compile errors that make no sense and crappy mobile drivers.)

Maybe the theme ini could even have a default hue/etc. that resets it when you apply the theme? I like the idea that it could be live and change over time. There are other interesting ideas like it could take the dominant hue from the most recent game you played.

This is even making me think of how I wanted to add UIScreen transition animations.

Not trying to overcomplicate, though. But I see no reason we can't do both...

-[Unknown]

Copy link
Owner

Choose a reason for hiding this comment

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

These shaders are at least quite a bit less complicated than some of the stuff we generate sometimes, so I think they'll be fine. I will test them on Mali-400 though :)

@iota97
Copy link
Contributor Author

iota97 commented Feb 14, 2022

About this do we really need all those settings for the theme?

  • Item and button aren't really consistent around the code base, we use button in a couple of place only with no much semantic difference from choice AFAICT.
  • No idea where highlighted is used, can't seem to find it anywhere.
  • InfoStyleBg doesn't seem to be used anywhere. Nvm this one is used in the dev screen

@hrydgard
Copy link
Owner

Yeah, let's try to minimize the number of them. Do delete any unused ones and feel free to merge as appropriate.

@OOKRONOO OOKRONOO mentioned this pull request Feb 14, 2022
@hrydgard hrydgard added this to the v1.13.0 milestone Feb 16, 2022
@hrydgard hrydgard added the User Interface PPSSPP's own user interface / UX label Feb 16, 2022
@hrydgard
Copy link
Owner

OK, I'm happy with this. Ready to go in?

@iota97
Copy link
Contributor Author

iota97 commented Feb 17, 2022

Yeah, I wanted to make at least another theme at first but I'm terrible at that :)

@hrydgard
Copy link
Owner

hrydgard commented Feb 17, 2022

Hm, I'm thinking about the theme names .. doesn't look like we've hooked them up for translation?

(looks like we have the same problem for the background animations too)

@iota97
Copy link
Contributor Author

iota97 commented Feb 17, 2022

Hm, I'm thinking about the theme names .. doesn't look like we've hooked them up for translation?

This should do it: f4b5c16, I just haven't synced the lang file.

@hrydgard
Copy link
Owner

Oh that's right!

@hrydgard hrydgard merged commit e88ddbb into hrydgard:master Feb 17, 2022
@iota97 iota97 deleted the theme branch February 17, 2022 09:47
@ghost
Copy link

ghost commented Feb 17, 2022

What Happen?
Can't see the new theme colors?
Screenshot_2022-02-17-19-04-05-239_org ppsspp ppsspp

@iota97
Copy link
Contributor Author

iota97 commented Feb 17, 2022

There isn't any new theme yet, but you may add them in /PSP/themes/whatever.ini

@ghost
Copy link

ghost commented Feb 17, 2022

There isn't any new theme yet, but you may add them in /PSP/themes/whatever.ini

Like this? 🤣
Screenshot_2022-02-17-19-38-34-518_com rhmsoft edit

@iota97
Copy link
Contributor Author

iota97 commented Feb 17, 2022

Well, themes folder must be lower case.

This should help generate a valid ini: https://ppsspp-theme-editor.onrender.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User Interface PPSSPP's own user interface / UX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants