cswendrowski / FoundryVTT-Custom-CSS

Allows a user to setup custom CSS rules in a FoundryVTT world
GNU General Public License v3.0
11 stars 9 forks source link

Permission-based CSS Suggestion #14

Open RossGosling opened 2 years ago

RossGosling commented 2 years ago

Hey, found this module exceptionally useful!

One suggestion I thought of was defining CSS by permission groups? Allowing CSS to be configured for Players, Trusted Players, Assistant GMs, and GMs.

Example cases could be

These features likely exist elsewhere but the flexibility would be brilliant through CSS

zeel01 commented 2 years ago

Most of these are things I would probably recommend a dedicated module for, rather than relying on hiding through stylesheet alone. But they would likely all be possible. The big issue would be that CSS can't actually have "permissions" in the way that other things can. There would be nothing stopping a user from overriding the styles locally, and it's very easy for them to do so. Now, I'm not generally one to worry about players cheating, but it's pretty low hanging fruit.

The issue with grouping by anything more than world/user is a matter of complexity. You will note that the GM can't modify the user-styles for the user, only for themselves, for instance. This is done with minimal complexity because Foundry offers different kinds of settings - "world" scope is used for one, and "client" scope for the other. This brings with it most of the functionality needed for users to have their own CSS along with what the GM adds for the world.

Adding more "slots" for styles would add a lot more complexity, and I'm not sure that it would be worth while for the results.

That being said, I do have an idea that I might pursue. Rather than styles that are configured per-permission or otherwise, it would be relatively easy for the module to insert additional classes into the body of the page, which could then be used to control styles. For instance, if all GM users would have the class .custom-css_isGM on the body of the page, then any style like:

.custom-css_isGM [...selectors...] {
   ...rules...
 }

Would only apply then. It's still absurdly easy to cheat, but also it's not that complicated to add.

I would need to do some experimenting though. I'm not sure if the class list on body remains static, or if anything might clear/reset it which would break the whole thing.

bland-html commented 2 years ago

Would love to see it though. There are certain hacks I would love to apply (like hiding Scene/Playlist names) or small little spoiler edits that would be super easy through CSS.

I don't love relying on Modules, especially when they do 10 other things that I don't necessarily need them to do, or are too niche for the developer to keep up to date.

I wouldn't even mind the cheating, since it would be extremely hard for them to even know about anyways. Unless all my players play with the Console open, scouring through the code lol, I can't imagine they would ever even find out.