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

Introduce themeswitcher #6240

Merged
merged 3 commits into from
Jan 19, 2022
Merged

Introduce themeswitcher #6240

merged 3 commits into from
Jan 19, 2022

Conversation

pascalwengerter
Copy link
Contributor

@pascalwengerter pascalwengerter commented Jan 12, 2022

Description

This is currently WIP, but allows users to switch between a dark and light theme (provided this is found in the theming configuration). It initializes with the browser preference

Related Issue

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Technical debt (removes workarounds related to theming/colors in the redesign)

Checklist:

  • Code changes
  • Update existing tests
  • Add new tests
  • Add changelog item
  • Save current theme to localStorage
  • Change icon/themeSwitcher component location
  • Add docs related to dark theme

@update-docs
Copy link

update-docs bot commented Jan 12, 2022

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@pascalwengerter pascalwengerter mentioned this pull request Jan 13, 2022
25 tasks
@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from d3e2928 to c30d211 Compare January 13, 2022 14:16
@tbsbdr
Copy link

tbsbdr commented Jan 13, 2022

👏
I propose the following switch:
switch shows the currently applied theme (not the to-be-switched theme); if your are in the dark mode, switch label is "Dark mode 🌚"
2022-01-13_16-09-55 (1)

@CLAassistant
Copy link

CLAassistant commented Jan 13, 2022

CLA assistant check
All committers have signed the CLA.

@@ -17,6 +17,7 @@ export const loadTheme = async (location = '') => {
return defaults
}
const theme = await response.json()
console.log('theme', theme)
Copy link
Contributor

Choose a reason for hiding this comment

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

dev leftover (well... still WIP... but shouldn't be committed)

@@ -109,7 +118,7 @@ const getters = {
return parsed
},
theme: (state) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the theme getter used at all? You were accessing the theme with configuration.currentTheme everywhere. If that's intended you might want to drop this getter entirely. Or map & use it instead of configuration.

Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

This looks so awesome already ❤️

@pascalwengerter
Copy link
Contributor Author

Could someone thoroughly test this with a locally linked owncloud/owncloud-design-system#1886 ? Rebased, animations fixed, extracted some things and fixed stuff the theme switch revealed in the ODS (so we'll need another release there)

Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Things that I found in the UI while testing:

  • (search bar is gone? sorry for the noise, was in ocis on a page that has no filtering)
  • can we have a small right margin for the left sidebar, so that (when the app has a left sidebar nav) the app content gets a little more distance from the sidebar? At the moment it looks too compact IMO.
  • when switching the theme the left sidebar has a slight delay / takes a little bit longer, compared to the rest of the UI

Dark mode:

  • form input fields background color is a dark blue, I'd have expected something gray-ish (was looking at e.g. invite input field for people sharing and the page size dropdown in view options)
  • OcDrop background same or too similar to the main background color, drop shadow exists but has no to little effect
  • "+ New" button has black text on blue button but should have white text afaik
  • the left sidebar nav items don't have the thick shadow on the right side of the nav icon
  • OcSwitch background in enabled state has very little contrast to the main background color
  • mediaviewer shows the label 1 of 3 in black instead of white
  • modals look broken

Light mode:
found nothing ✅

Edit:

  • OcDrop styling is part of another story, if there are no easy fixes here, then keep it for later.

@pascalwengerter
Copy link
Contributor Author

Things that I found in the UI while testing:

* (~search bar is gone?~ sorry for the noise, was in ocis on a page that has no filtering)

* can we have a small right margin for the left sidebar, so that (when the app has a left sidebar nav) the app content gets a little more distance from the sidebar? At the moment it looks too compact IMO.

* when switching the theme the left sidebar has a slight delay / takes a little bit longer, compared to the rest of the UI

Dark mode:

* form input fields background color is a dark blue, I'd have expected something gray-ish (was looking at e.g. invite input field for people sharing and the page size dropdown in view options)

* OcDrop background same or too similar to the main background color, drop shadow exists but has no to little effect

* "+ New" button has black text on blue button but should have white text afaik

* the left sidebar nav items don't have the thick shadow on the right side of the nav icon

* OcSwitch background in enabled state has very little contrast to the main background color

* mediaviewer shows the label `1 of 3` in black instead of white

* modals look broken

Light mode: found nothing white_check_mark

Edit:

* OcDrop styling is part of another story, if there are no easy fixes here, then keep it for later.

Thanks for testing @kulmann, did you try it with owncloud/owncloud-design-system#1887 locally linked?

@kulmann
Copy link
Contributor

kulmann commented Jan 17, 2022

Thanks for testing @kulmann, did you try it with owncloud/owncloud-design-system#1887 locally linked?

Yes 😇
You meant 1886. 1887 is an issue in ODS.

@pascalwengerter
Copy link
Contributor Author

Things that I found in the UI while testing:

* (~search bar is gone?~ sorry for the noise, was in ocis on a page that has no filtering) 

* can we have a small right margin for the left sidebar, so that (when the app has a left sidebar nav) the app content gets a little more distance from the sidebar? At the moment it looks too compact IMO.

✅ rather added a padding to the router-view, right margin on the sidebar messed with the border-shadow

* when switching the theme the left sidebar has a slight delay / takes a little bit longer, compared to the rest of the UI

✅ added the same to the app content area now, please check if it's to your liking

Dark mode:

* form input fields background color is a dark blue, I'd have expected something gray-ish (was looking at e.g. invite input field for people sharing and the page size dropdown in view options)

✅ now has one of the "standard dark theme background colors", similar to the form field background in light mode

* OcDrop background same or too similar to the main background color, drop shadow exists but has no to little effect

✅ not to resolve in this ticket, can't find the exalated ticket yet though

* "+ New" button has black text on blue button but should have white text afaik

✅ should be resolved now

* the left sidebar nav items don't have the thick shadow on the right side of the nav icon

✅ resolved

* OcSwitch background in enabled state has very little contrast to the main background color

owncloud/owncloud-design-system#1887, ✅ resolved by changing colors & adding a small border around it

* mediaviewer shows the label `1 of 3` in black instead of white

✅ resolved

* modals look broken

✅ resolved in the ODS, needed a background color

Light mode: found nothing white_check_mark

Edit:

* OcDrop styling is part of another story, if there are no easy fixes here, then keep it for later.

Commits for review incoming

@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from 7951d7d to 07ff96f Compare January 18, 2022 09:16
@pascalwengerter
Copy link
Contributor Author

@kulmann what do you think in terms of a11y, add a tooltip&aria-label to the button and make the text aria hidden?

Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Some more minor things:

dark mode

  • pagination has dark colors / no contrast
  • notification bell has dark colors / no contrast
  • search indicators in table header has dark colors / no contrast
  • people invite form field has dark text color in autocomplete items (usernames and sharee type)
  • OcSwitch color contrast is still bad

@pascalwengerter
Copy link
Contributor Author

Some more minor things:

dark mode

* pagination has dark colors / no contrast

✅ consider it fixed in ODS

* notification bell has dark colors / no contrast

✅ consider it fixed in web

* search indicators in table header has dark colors / no contrast

You mean sorting buttons? That's a tough one since we render (colored) SVGs here...

* people invite form field has dark text color in autocomplete items (usernames and sharee type)

I don't find it too bad, what would you like to change?
Screenshot from 2022-01-18 15-45-28

* OcSwitch color contrast is still bad

Any suggestions how to go about it?

@kulmann
Copy link
Contributor

kulmann commented Jan 18, 2022

* search indicators in table header has dark colors / no contrast

You mean sorting buttons? That's a tough one since we render (colored) SVGs here...

Yes, the sorting buttons. Would suggest to add a white outline to the icons, so that they are compatible with light and dark mode at the same time.

* people invite form field has dark text color in autocomplete items (usernames and sharee type)

I don't find it too bad, what would you like to change? Screenshot from 2022-01-18 15-45-28

True, keep it like it is.

* OcSwitch color contrast is still bad

Any suggestions how to go about it?

Same as for the sorting icons, add a white outline, so that it's compatible with light and dark mode at the same time. The knob in the middle is not that easily visible as well, though.

@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from e334466 to 280ee7c Compare January 18, 2022 15:44
@pascalwengerter pascalwengerter marked this pull request as ready for review January 18, 2022 16:22
@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from 280ee7c to c1be7b4 Compare January 18, 2022 17:26
Copy link
Contributor

@kulmann kulmann left a comment

Choose a reason for hiding this comment

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

Unit tests need fixing, but otherwise this is gold 🥇 happy to get it merged asap!

@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from c1be7b4 to cb7d04e Compare January 19, 2022 09:08
Copy link
Contributor

@fschade fschade left a comment

Choose a reason for hiding this comment

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

❤️ LGTM

@ownclouders
Copy link
Contributor

Results for oCISTrashbinUploadMoveJourney https://drone.owncloud.com/owncloud/web/22016/66/1
💥 The acceptance tests pipeline failed. The build has been cancelled.

@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from cb7d04e to d90097c Compare January 19, 2022 09:33
@ownclouders
Copy link
Contributor

Results for oC10iPhone1 https://drone.owncloud.com/owncloud/web/22017/47/1
💥 The acceptance tests pipeline failed. The build has been cancelled.

@pascalwengerter pascalwengerter force-pushed the introduce-themeswitcher branch from d90097c to bf6b1a9 Compare January 19, 2022 14:02
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

51.5% 51.5% Coverage
0.0% 0.0% Duplication

@pascalwengerter pascalwengerter merged commit 072b947 into master Jan 19, 2022
@delete-merged-branch delete-merged-branch bot deleted the introduce-themeswitcher branch January 19, 2022 15:20
ownclouders pushed a commit that referenced this pull request Jan 19, 2022
Merge: ab6974b bf6b1a9
Author: Pascal Wengerter <pwengerter@owncloud.com>
Date:   Wed Jan 19 16:20:10 2022 +0100

    Merge pull request #6240 from owncloud/introduce-themeswitcher

    Introduce themeswitcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add possibility to switch dark/light theme
6 participants