-
Notifications
You must be signed in to change notification settings - Fork 687
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
Theme selector on the client #568
Conversation
Nice! Would it be possible to save the theme selection in the user's config file? |
I've had a quick look through the code, and I'll test it later, but just a quick point, can we not remove the default theme from the settings, because I have a feeling you'll get a flash on page load if you use a non default theme until Java script loads and chooses the theme. Also, I don't want to have to change theme on every machine. But I'll test it later. |
I haven't noticed such flash but I'll do some more research/testing. Note that the default config is not the right place to solve this if there is one, and there will be one whether or not I leave this in the defaults.
Actually, this is on purpose, for several reasons:
So I'd strongly argue it should stay that way for consistency with the other settings and for usability purposes. Plus it really should not be an administrator decision to pick what background color you have to look at on your IRC client :D |
Sorry, that's not what I mean. I'm not suggesting that we have it sync to the server, that's a different issue (which as you say, should happen in #275) However, if we have no "default" theme set on the user settings, which we use as the default for the browser, we aren't leaving that up to the user, we are enforcing the default to be the lounge default. Sure, I can change that on every machine that I use, and it will stay that theme once I change it on that machine, but we shouldn't take away the option of defining a default one in the first place. All I'm asking is that we keep the setting for a user's default theme, set that as the default on the page. After that, everything else stays the same. |
I actually have the opposite point of view on this and don't think we should do this. First of all, with the addition of this PR, there is not much point in doing so. Actually, the only benefit would be not changing anything for the existing users and considering we only ship 4 themes and a major version, I really don't have an issue with that. If themes had been client-side from the beginning, making a default theme on the server-side would have never been an enhancement request we would have accepted :D Now, on the longer term, picture us in a world where you can easily add themes to The Lounge. We'll want to ship it with at least one theme that you cannot remove. In terms of enhancements, it makes sense to have an official theme that we know works flawlessly with every new version, and other themes are separately maintained (maybe under the same organization, but still). Anyway, I'm losing myself here. My point is: it's pointless to have the administrator-side make decision on what theme users will use, and it's even more pointless now that users can super easily change them. |
It isn't pointless until we get #275 sorted, and settings can be synced. It's especially not pointless if you thin kthat the majority of people running the lounge are not running it on a hosted version run by someone else, but are running their own version. Then it's not "an administrator", but rather it is themselves. I agree that it will be pointless once we have settings syncing, but until then we are removing a feature, which I highly disagree with.
Yeah, but we already have that. If a user doesn't set the default theme for themselves on the server, it is set as a default to be the default that we decide. But if we don't have an option on the server, the user will still have a default, but instead of set by them (or their administrator) it is set by us. |
By the way, here is a copy of the flash I was talking about. Notice how it is white to start with, because it doesn't use the selected theme until Javascript is fully loaded and we have the user settings. If you have a server-side theme, then this doesn't happen as the theme is loaded from as soon as we get any html, so it always uses the right css. If you choose a different theme on 1 computer, then obviously you'll still get that flash, but there's no way around that, tbh. This might not annoy you, but it annoys me a ridiculous amount. |
I totally agree with @YaManicKill here. We should still keep the default theme config, and simply replace the loaded stylesheet when the user logs in, even if it wasn't for the flash. There are many reasons the theme should apply before the user logs in. This is also needed to set the default theme for public instances. |
Well, that's a different story. This is not what The Lounge is, and making this assumption to build features means you are likely to misrepresent users that are not their own administrators.
Absolutely not. We are changing a feature, improving it even. And making it more consistent with all other user preferences.
This shows again that you are seeing The Lounge as a one user/administrator system. In a nutshell: I'm all for finding ways to reduce the flash issue, but having a default theme on the server configuration will not solve it. At best, it will hide for yourself in your very own configuration. Seriously, theme on the admin-side of things is not the right way to go. I don't see you complain about admin-side defaults for joins/quits, for custom CSS, for colored nicknames. All these have app defaults, pattern which this PR is applying for theme as well and makes a user decision consistent. Yes it's a change, but not one to be against really. In practice, setting it to your N devices will take you a couple minutes at worst, and then you're done. Forever maybe. Honestly, I don't understand there is that much debate around a detail like that. I don't see it objectively evolve as your opinion is set, so I won't debate any further on this very point and focus on all the other things there is to do. If you're very much against this PR, please close it and do something better. Open to feedback otherwise. |
... Because... ?
... Such as... ?
Needed? No. Again, I don't see why we are arguing in favor of inconsistency. |
5eb8748
to
e8f5e7e
Compare
@@ -15,7 +15,7 @@ | |||
|
|||
<link rel="stylesheet" href="css/bootstrap.css"> | |||
<link rel="stylesheet" href="css/style.css"> | |||
<link id="theme" rel="stylesheet" href="<%= typeof(theme) !== "undefined" ? theme : "themes/example.css" %>"> | |||
<link id="theme" rel="stylesheet" href="<%= theme %>"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a somewhat revert of #474, which was fixed at the time but tested on an outdated master, so it was not needed anymore.
I re-added the default theme partly because @maxpoulin64 finally gave the first compelling argument on the subject (but also because I'm done fighting): if you own a bunch of services and you want to provide to your users The Lounge with a similar set of colors to others. Note that I haven't tested changes around custom default theme, so feel free to test your use cases. |
Does The Lounge need to be restarted for new themes to be picked up for the theme selector? |
@vectr0n, with the theme selector on the client added by this PR, it doesn't need server restart (it does need restart on master currently). It doesn't even need reload, it changes when selecting it :-) EDIT:
|
Huh, I had never noticed this was a global default, rather than per-user. I would be happy with it moving to the user config.
No, because they are fundamentally different. When I set those settings on my client, they never change back. But with the theme, the default theme is set for milliseconds every single boot. The other ones having a different default only affects me when I go onto a new machine. I am in favour of "inconsistency" because the theme works differently to everything else. It drives me insane seeing that flash every single time I load the page.
Except that if we don't have this, then they will see ... the default theme until they login. The other solution is no different in this respect.
There is 1 flash from pressing the button to having the page actually load something, I accept that. However, it doesn't happen over refreshes (the default theme thing does) and there's (as far as I know) nothing we can do about that. Not ideal, but not as bad as the issue here. I didn't want to continue arguing after you've fixed it, but I think you are being incredibly unfair with how you are putting my points across. And the thing is, you are under the false presumption that us not having a default theme in the config means there is no default theme. This is fundamentally false. It just means that instead of the administrator deciding the default theme, we decide it, and they can't override it. The default is still there. |
Looks good to me! The only think I notice is that the box grey, which makes it looks like it's disabled. Maybe theme it the same as the other controls? |
…ue statement, transform ifs into else-ifs
Power to the people! There is now 2 ways to set the theme: on the app config file (defaults for all users) and in the user settings. All CSS files present in the `client/themes` folder will be given as choices to the users. This is temporary (as in, temporary for a fairly long time) until we have proper theme management.
Turns out, this theme probably never loaded its font right, fail... `GET https://.../themes/fonts/inconsolatag.woff` --> 404
e8f5e7e
to
d5f234b
Compare
@maxpoulin64, very good point, I updated my PR accordingly. Also updated PR description to add screenshots for all themes, and rebased with master. (Wow, AppVeyor finishing before Travis CI, in what world are we living...) |
👍 |
Yeah, looks good. Great to get this feature finally in. 👍 and merging. Oops, another feature in 2.0.0 without releasing :-P |
Theme selector on the client
This adds one of the 2 features mentioned in #5 (comment), yup.
Beyond the obvious benefits from the user's perspective, this will help contributors/team members:
style.css
: at the moment, users who want to set custom themes have to add the@import 'themes/<theme>.css';
hack into their custom CSS. Currently themes spend a lot of effort canceling out design choices set instyle.css
so that's fine, but as we make themes "independent", this hack will not reliably work anymore.More information in commit messages.
Results