itsgoingd / clockwork-chrome

Clockwork - php dev tools integrated to your browser - Chrome extension
https://underground.works/clockwork
411 stars 25 forks source link

Dark theme #22

Closed plakhin closed 7 years ago

plakhin commented 7 years ago

It would be nice to have dark theme support

itsgoingd commented 7 years ago

Hey, I was already looking into this some time ago, though it was not possible at that time, since there was no way to know which theme is used. Since then a new API was added that makes this possible, so you can look forward to this feature in a future release.

plakhin commented 7 years ago

Thanks for response, sounds great!

KKSzymanowski commented 7 years ago

I'm also looking forward to this feature.

For theme detection you can probably use something similar to what Vue Devtools are using. If the dark theme is detected, you can add a dark class to eg. the body.

It will probably be quite cumbersome to apply all these changes in plain CSS, so I'd suggest moving to SCSS. You could define a mixin:

@mixin dark() {
  body.dark & {
    @content;
  }
}

and include it wherever you need:

.data-grid-requests .selected td {
  background: #3879D9 !important;
  color: white;

  @include dark {
    background: $some-other-color !important;
  }
}

I gave it a go, but I'm not familiar with the plugin structure nor with AngularJS, so I gave up. You would probably do this much quicker. If you'd happen to need any assistance, I'd be happy to help.

For a quicker start, I'll tell you what I have achieved so far:

itsgoingd commented 7 years ago

Hey, thanks for the extensive comment, this is pretty much what I'm planning to do.

I wasn't sure about using SCSS at first, since adding a build step makes things more complicated, but I guess the benefits (especially for this feature) are worth it. Actually I didn't know node-sass has a watch support ootb, this makes it event simpler.

I'm finishing up on a styles and markup cleanup and the dark theme is next on the list, so this should be done very soon.

KKSzymanowski commented 7 years ago

Out of pure curiosity, what is your workflow with developing Chrome Extensions? After 10 minutes I found constantly hitting F12, F12 to refresh the devtools quite tiring.

itsgoingd commented 7 years ago

Haha, nothing special. I like to do a lot of the UI design/prototyping directly in the browser via dev tools. Usually I'll throw up a quick markup in my text editor, maybe some basic styles, tweak it in the dev tools over and over and copy the changes back to the stylesheet.

Chrome allows you to open dev tools for a dev tools window via chrome://inspect, which is also the only sane way to debug javascript part of the extension (used to be much more complicated few years back).

Clockwork is also just a normal web app that you can run in the browser and easily hack to load some sample data, I like to use the php cli server (php -S localhost:8000). This way you can use any web app development flow you like.

This will be used in the next server-side Clockwork version where a full Clockwork app will be available at http://your.app/__clockwork. I already have this implemented in a local branch so I've been using this a lot recently when developing features for the app.

KKSzymanowski commented 7 years ago

Chrome allows you to open dev tools for a dev tools window via chrome://inspect

I didn't know that. This sounds very useful.

itsgoingd commented 7 years ago

Implemented in https://github.com/itsgoingd/clockwork-chrome/pull/25, includes a few screenshots.

Some of the colors might need to be tweaked a bit more, let me know what you think!

KKSzymanowski commented 7 years ago

Is the new version with dark theme released? I updated and reinstalled the extension and I still get the classic theme.

itsgoingd commented 7 years ago

Hey, not released yet, sorry.

I'm wrapping up a new major release, which is taking a way longer than I'd like, but it should be ready soon-ish.

KKSzymanowski commented 7 years ago

All right, thanks

itsgoingd commented 7 years ago

Released now. 🚀