Repository navigation
Select appearance (theme) via the preferences dialog - #4919
Conversation
|
This is ready for review 🙇 |
nerdneha
left a comment
There was a problem hiding this comment.
One thing I'm trying to understand is if we could avoid some logic by dropping the theme-light or theme-dark class directly into the App component's className list (L1717 -- https://github.com/desktop/desktop/pull/4919/files#diff-14c781d4474997ba566167e985791f94R1717)
I feel like there's a good reason why we're not doing that but it'd be great to understand that from my perspective.
| * render when its props changes (shallow comparison). | ||
| * | ||
| * This component does not render anything into the DOM, it's | ||
| * purely (a)busing the component lifecycle to manipulat the |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| } | ||
|
|
||
| private ensureTheme() { | ||
| const newThemClassName = `theme-${getThemeName(this.props.theme)}` |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| @@ -0,0 +1,50 @@ | |||
| import * as React from 'react' | |||
| //import { Row } from '../lib/row' | |||
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
| { | ||
| title: 'Dark (beta)', | ||
| description: | ||
| 'A beta version of our coming dark theme. Still under development. Please report any issues you may find to our issue tracker.', |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
|
||
| return ( | ||
| <DialogContent> | ||
| <VerticalSegmentedControl |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
It has to do with inheritance of the variables. We need to override them as close to (and ideally at) the root pseudo element as possible. Here's what it looks like if we apply it on the App component instead of body. See that label, since we haven't put an explicit color on that it's inheriting the default color from body. Now, one could argue that we should set an explicit color on it but by applying it to body we're safe-guarding against these sorts of inconsistencies. In the future I want to have the dark theme live in its own compiled css file that gets conditionally loaded instead of toggling it through a class name. That way we can actually override |
|
Ready for another look 🙇 |

Note: This builds upon #4849 so the diff is much more complicated than it'll be once that landsThis PR adds the ability to switch (and persist) the application theme using the preferences dialog.