UI: Implement Web Assets' theme system, and add 'dark' theme #103972
No reviewers
Labels
No Label
legacy project
Infrastructure: Websites
Priority
High
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Resolved
Type
Bug
Type
Design
Type
Report
Type
To Do
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: infrastructure/conference-website#103972
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ui/theme-system"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This pull request enables the theme system, and the optional Web Assets v2 dark theme. It resolves local contrast issues, and makes the necessary project-specific changes. It addresses dynamic location colours' theme-specific adjustments as well.
The theme remains light by default, that users can set to either 'system-preferred' or 'light' respectively. User selection is stored in browser's local storage, and will prevail on next page loads.
Screenshots:
WIP: Implement Web Assets' theme system, and add 'dark' themeto UI: Implement Web Assets' theme system, and add 'dark' theme@ -22,3 +24,3 @@
--color-bg: var(--body-color-bg)
--navbar-bg: #1e1e1e
// --box-bg-color-hover: var(--btn-color-bg-hover)
Left over comment
@ -261,6 +270,10 @@ button.going-star
.form-check-input
transform: scale(1.5) translateX(calc(var(--spacer) * -1))
// TODO: remove rule after Web Assets v2 component nav-pills has been implemented
Hasn't this be implemented already?
08054cfd5f
Thanks for the reference. It was added to web-assets, but not yet implemented to the Conference website at the time of the commit. Now it's present on
main
, and I cleaned up the style in the PR that became redundant in the meanwhile. 👍Can you run this reliably? When I switch pages I get several glitches:
Testing this after deleting the
/public/static
folder (several times). Using Chrome, dev tools with caching disabled so it's fresh every load. (Local storage is persistent though).Managed to reproduce twice again. But can't figure out the steps.
This is how I'm testing it:
/public/static
folder.My system appareance is set to Light. Using Chrome on macOS Sequoia.
@pablovazquez thanks for the detailed reports!
The above issues were resolved, and the fix has been released as Web Assets v2.0.0-alpha.41, as discussed IRL. I recorded the details in the following issue for reference: infrastructure/web-assets#94705 Theme features should now work consistently in the project in all browsers.
Did you change the location colors locally? With the current default color for the Theater (
#5f1bef
) I get really low contrast (1.06) on presentation details. ExampleThe "socket" of unselected filters is still pure white
Unclaimed tickets copy field is unstyled
The horizontal schedule items are a bit too low contrast, they look almost "disabled".
Current
backdrop-filter: brightness(0.9);
:Proposed
backdrop-filter: brightness(0.75);
:What if we styled the favorite/going items differently? Just a mockup:
There is a flicker in loading the theme that is quite noticeable on pages heavy on images, like Speakers, Attendees, or Schedule.
This is not just a problem of our implementation but something many run into when introducing themes.
Some propose using a bit of inline Javascript (vanilla) in the
<head>
, before anything, which is probably the best. Outlined in this StackExchange answer or this GitHub comment.I didn't change any location colours explicitly, but introduced dynamic luminance adjustments based on active theme. As location colours are applied on a per component basis, I overlooked some items. I did another pass based on the above, all items should look correct now. If we come accross any items that are displayed with low contrast, we can add more luminance values to
theme-dark-schedule
andtheme-light-schedule
mixins.Thanks: this is fixed now.
This is indeed a problem that is currently present in all project using our Web Assets theme system. Thanks for pointing to the threads. I see the JS has to manage two different things here:
I'd open a dedicated issue in Web Assets soon, and address it there. We could deploy the fix as a patch release in all projects using BWA. I think it isn't strictly related to the PR though, but we can do the patch before the merge.
I addressed, but not sure about this one. For now I set the 'sockets' colours to match button text colours, as they're replaced by checkmarks, that are coloured like this. I think it's okay since they're not strictly 'sockets' (like in radio buttons), but abstract signs representing unselected items. Alternatively I think it's also ok to just hide checkmarks and sockets, as active and inactive states are already managed by colours visually.
aace9653cb
to42cf6d703a
@pablovazquez fickering has been resolved within the framework of issue #94706 in Web Assets. It has been implemented here, and no flickering should happen from now onwards.
Tested with 'artificial' throttling simulating slow networks, and looks good to me. 🤞
Thank you for tackling all issues! Love the followed/assisting items in the schedule.
@ -1,0 +7,4 @@
--schedule-filters-container-location-color-l: 60%
.schedule-container
&.horizontal
Any reason to limit this to the horizontal layout? The same concept could be used in the vertical schedule.
Sorry for the late reponse, just noticed the new comments.
I like the idea to display followed/assisting items in the vertical schedule more remarkably, but I think here it should look different, as the vertical layout doesn't have the coloured rows by location. Maybe we should just apply a slightly different tone of grey to highlighted items' backgrounds? Or shall we try to go for location-based colouring here as well, possibly with less saturated tones?
Based on this, I think the existing rule is correct, and we could extend vertical layout styles with additional rules.
@ -1,0 +15,4 @@
backdrop-filter: brightness(80%)
/* Event favourited styles */
&:has(button[data-is-checked="data-is-checked"])
Seems that when the button is pressed, it only adds the
data-is-checked
attribute but it doesn't assign any value. So the user has to reload the page for it to update in real time.Perhaps we could replace the check:
From:
&:has(button[data-is-checked="data-is-checked"])
To:
&:has(button[data-is-checked])
So it updates as it is pressed.
Thanks, this is indeed much nicer with the less specificity, and works without page reload! 👍 I updated accordingly.
@pablovazquez I'm merging the pull request as discussed IRL. I think this update can be done on
main
, as it isn't coupled with the theme-system update.