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

Applies a dark theme, based on a global class #243

Merged
merged 5 commits into from
Feb 15, 2017

Conversation

jhoff
Copy link

@jhoff Feb 3, 2017

I need a little help here, but I did most of the the leg work from a styling perspective.

According to https://bugs.chromium.org/p/chromium/issues/detail?id=608869, there should now be possible to get the value of the chrome devtool theme via chrome.devtools.panels.themeName.

I'm not familiar enough with chrome devtool development to know how to do it correctly, so hopefully this is an easy one for someone that knows what they're doing.

Implementation of the dark theme is done by adding a dark class to the root #app element. See change to line 4 at src/devtools/App.vue.

Edit: When installed in chrome devtools, now detects the theme automatically. Note: the dark theme doesn't work when running npm run dev. You will have to add the dark class manually to test that I guess.

screenshot from 2017-02-03 00-09-17
screenshot from 2017-02-03 00-09-50
screenshot from 2017-02-03 00-10-13
screenshot from 2017-02-03 00-16-39

Also, any feedback would be appreciated.

Copy link
Author

This is an implementation of #79 and #84

Copy link
Member

Cool! Just make sure it's synced with the devtools colour

Copy link
Author

Yup I used all of the same background and border colors that the dark theme already uses.

Copy link
Member

I meant that the theme should be dark only when the devtools are in dark mode too. But you're right to do so, thanks for pointing that out 👍

Copy link
Author

@posva Right, which is why this is marked as a [WIP]. I mentioned in the description that I needed some help finishing that part up. I don't know anything really about extension development. It seems that we can determine which theme devtools is currently using through the chrome.devtools.panels.themeName property, but chrome.devtools is undefined within the scope of App.vue when running npm run dev ( which makes sense ).

I'll dig into it a little more, but in the meantime if anyone has a recommendation on the best way to implement the switch from light to dark, let me know. I just don't have a lot of bandwidth at the moment.

Copy link
Author

Ok It wasn't as complicated as I made it out to be in my head. This should be ready to go.

image
image

Copy link
Member

Thanks a lot for looking into this.
I need to test this locally and will come back to you asap

@crswll
Copy link
Contributor

crswll commented Feb 10, 2017

Sweet. I was just about to start working on this. Looks good.

Copy link
Member

Sorry for the delay, testing now. I'll let you know 🙂

Copy link
Member

@posva

Choose a reason for hiding this comment

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

Looks good!

Copy link
Member

ping @yyx990803

@crswll
Copy link
Contributor

crswll commented Feb 11, 2017

My only objection, not that it matters, is this is very hard to read. I'd personally find it frustrating if I used the dark theme regularly (only reason I don't is because of the vue-devtools).

screen shot 2017-02-11 at 1 09 39 pm

@yyx990803
Copy link
Member

Nice work - as @crswll mentioned, I think we should give the text in the state inspection panel more contrast (especially the purple and the gray base text).

Copy link
Member

Maybe using a cyan instead of the purple and orange instead of red or something similar to
screen shot 2017-02-11 at 19 25 03

@yyx990803
Copy link
Member

Yeah, emulating the color scheme of the native devtool would be great.

Copy link
Author

I'll get this updated in the next day or so as soon as I get back from vacation

Copy link
Author

Feb 14, 2017

image

How's this look? ( all colors pulled from the dev tools elements tab )

Copy link
Member

Looks good!
Where, in the elements tab did you find those colors?

Copy link
Author

Mostly from the properties viewer for HTML elements:

image

@andreiglingeanu
Copy link
Contributor

Very nice looking!

@@ -60,7 +60,8 @@ export default {
computed: mapState({
message: state => state.message,
tab: state => state.tab,
newEventCount: state => state.events.newEventCount
newEventCount: state => state.events.newEventCount,
isDark: () => chrome.devtools && chrome.devtools.panels.themeName === 'dark'
Copy link
Member

@yyx990803 yyx990803 Feb 15, 2017

Choose a reason for hiding this comment

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

A few small things:

  • The devtools code itself doesn't assume it's always running in Chrome. We need to check typeof chrome !== 'undefined' first.

  • isDark doesn't really need to be a computed property. It's initialized only once and shouldn't be in mapState either. Let's move it to data() instead.

Should be good to merge after fixing these. Great work!

Copy link
Author

Choose a reason for hiding this comment

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

Hows that look?

@yyx990803 yyx990803 merged commit 537c524 into vuejs:master Feb 15, 2017
@yyx990803
Copy link
Member

Thank you @jhoff , great work! 👍

@ackzell
Copy link

ackzell commented Sep 12, 2017

Hello,

I just found out a way to integrate vue-devtools into an NW.js dev project. This makes it awesome to have a Vue dev env targeted for nw!

What I found though, is that the dark theme is not being applied to the NW dev tools once I change the theme. I noticed that it has a different menu for changing themes on the settings pane.

NW (0.24.4):
image

Chrome (60.0.3112.113 (Official Build) (64-bit) ):
image

I think something on this check isn't being matched in the case of the chrome object in NW:
https://github.com/vuejs/vue-devtools/blob/master/src/devtools/App.vue#L57

I forced it to be true and rebuilt the extension for my use case, that made it appear dark.

I acknowledge I don't know enough about NW.js yet nor much about how closely it is a "Chrome" window. Much less about creating extensions! Also know that it is a bit of a stretch to ask for a fix on such a thing, I just thought it would be worth sharing my findings.

Cheers!

Copy link
Member

@ackzell If anyone finds out how to fix it, we'll welcome a PR 👍

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.

6 participants