Skip to content

Select appearance (theme) via the preferences dialog - #4919

Merged
niik merged 14 commits into
masterfrom
darth-preferences
Jun 19, 2018
Merged

niik merged 14 commits into
masterfrom
darth-preferences

Conversation

@niik

@niik niik commented Jun 11, 2018 •

Copy link
Copy Markdown
Member

Note: This builds upon #4849 so the diff is much more complicated than it'll be once that lands

This PR adds the ability to switch (and persist) the application theme using the preferences dialog.

theme-selector

@niik niik mentioned this pull request Jun 11, 2018
8 of 12 tasks
@niik niik added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jun 13, 2018
@niik

niik commented Jun 13, 2018

Copy link
Copy Markdown
Member Author

This is ready for review 🙇

@niik niik mentioned this pull request Jun 13, 2018
@nerdneha nerdneha self-assigned this Jun 15, 2018

@nerdneha nerdneha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread app/src/ui/app-theme.tsx Outdated
* 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.

Comment thread app/src/ui/app-theme.tsx Outdated
}

private ensureTheme() {
const newThemClassName = `theme-${getThemeName(this.props.theme)}`

This comment was marked as spam.

Comment thread app/src/ui/preferences/appearance.tsx Outdated
@@ -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.

Comment thread app/src/ui/preferences/appearance.tsx Outdated
{
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.


return (
<DialogContent>
<VerticalSegmentedControl

This comment was marked as spam.

This comment was marked as spam.

@niik

niik commented Jun 15, 2018

Copy link
Copy Markdown
Member Author

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.

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.

screen shot 2018-06-15 at 13 32 47

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 :root instead which will let us have themeable backdrops and other overrides for pseudo-elements which doesn't inherit from :root.

@niik

niik commented Jun 15, 2018

Copy link
Copy Markdown
Member Author

Ready for another look 🙇

@shiftkey shiftkey mentioned this pull request Jun 18, 2018
2 tasks done
@niik
niik merged commit 519fdba into master Jun 19, 2018
@niik
niik deleted the darth-preferences branch June 19, 2018 10:40
@lock lock Bot locked as resolved and limited conversation to collaborators Aug 18, 2018
@desktop desktop unlocked this conversation Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants