Skip to content

Commit 537c524

Browse files
Jordan Hoffyyx990803
Jordan Hoff
authored andcommitted
Applies a dark theme, based on a global class (#243)
* Applies a dark theme, based on a global class * Auto-detect theme from devtools * isDark doesn't use state param * Updated colors for visibility * Remove isDark from computed properties
1 parent aa1c158 commit 537c524

File tree

11 files changed

+83
-13
lines changed

11 files changed

+83
-13
lines changed

src/devtools/App.vue

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<style lang="stylus" src="./global.styl"></style>
22

33
<template>
4-
<div id="app" class="app">
4+
<div id="app" :class="{ app: true, dark: isDark }">
55
<div class="header">
66
<img class="logo" src="./assets/logo.png" alt="Vue">
77
<span class="message-container">
@@ -52,6 +52,13 @@ import { mapState } from 'vuex'
5252
5353
export default {
5454
name: 'app',
55+
data () {
56+
return {
57+
isDark: typeof chrome !== 'undefined' &&
58+
typeof chrome.devtools !== 'undefined' &&
59+
chrome.devtools.panels.themeName === 'dark'
60+
}
61+
},
5562
components: {
5663
components: ComponentsTab,
5764
vuex: VuexTab,
@@ -102,11 +109,13 @@ export default {
102109
width 100%
103110
height 100%
104111
user-select none
105-
background-color #fff
112+
background-color $background-color
106113
display flex
107114
flex-direction column
108115
h1
109116
color #42b983
117+
&.dark
118+
background-color $dark-background-color
110119
111120
.header
112121
display flex
@@ -115,6 +124,8 @@ export default {
115124
box-shadow 0 0 8px rgba(0, 0, 0, 0.15)
116125
font-size 14px
117126
position relative
127+
.app.dark &
128+
border-bottom 1px solid $dark-border-color
118129
119130
.logo
120131
width 30px
@@ -137,9 +148,11 @@ export default {
137148
cursor pointer
138149
position relative
139150
border-bottom-color transparent
140-
background-color #fff
151+
background-color $background-color
141152
color #888
142153
transition color .35s ease
154+
.app.dark &
155+
background-color $dark-background-color
143156
144157
&:hover
145158
color #555
@@ -186,6 +199,8 @@ $event-count-bubble-size = 18px
186199
position absolute
187200
right 0
188201
top 12px
202+
.app.dark &
203+
background-color $dark-background-color
189204
190205
.active-bar
191206
position absolute

src/devtools/common.styl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// Colors
22
$blue = #44A1FF
3-
$green = #42b983
4-
$darkerGreen = #3ba776
3+
$grey = #DDDDDD
4+
$green = #42B983
5+
$darkerGreen = #3BA776
6+
$slate = #242424
7+
$white = #FFFFFF
58

69
// The min-width to give icons text...
710
$wide = 820px
@@ -11,5 +14,11 @@ $tall = 300px
1114

1215
// Theme
1316
$active-color = $darkerGreen
14-
$border-color = #dddddd
17+
$border-color = $grey
18+
$background-color = $white
1519
$component-color = $active-color
20+
21+
$dark-active-color = $active-color
22+
$dark-border-color = lighten($slate, 10%)
23+
$dark-background-color = $slate
24+
$dark-component-color = $active-color

src/devtools/components/ActionHeader.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
height 35px
1818
@media (min-height: $tall)
1919
height 50px
20+
.app.dark &
21+
border-bottom 1px solid $dark-border-color
2022
2123
.component-name
2224
display flex

src/devtools/components/DataField.vue

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ export default {
130130
</script>
131131

132132
<style lang="stylus" scoped>
133+
@import "../common"
134+
133135
.data-field
134136
user-select text
135137
font-size 12px
@@ -164,7 +166,7 @@ export default {
164166
&.literal
165167
color #0033cc
166168
.type
167-
color #fff
169+
color $background-color
168170
padding 3px 6px
169171
font-size 10px
170172
line-height 10px
@@ -199,13 +201,30 @@ export default {
199201
border 1px solid #e3e3e3
200202
border-radius 3px
201203
padding 8px 12px
202-
background-color #fff
204+
background-color $background-color
203205
line-height 16px
204206
box-shadow 0 2px 12px rgba(0,0,0,.1)
205207
.key
206208
width 90px
207209
.meta-field
208210
display block
211+
.app.dark &
212+
.key
213+
color: #e36eec
214+
.value
215+
color #bdc6cf
216+
&.string
217+
color #e33e3a
218+
&.null
219+
color #999
220+
&.literal
221+
color #997fff
222+
.type
223+
color: #242424
224+
.meta
225+
border 1px solid $dark-border-color
226+
background-color $dark-background-color
227+
209228
210229
.more
211230
cursor pointer

src/devtools/components/ScrollPane.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ export default {
4848
.scroll
4949
flex 1
5050
overflow overlay
51+
.app.dark &::-webkit-scrollbar
52+
background: $dark-background-color
53+
border-left: 1px solid $dark-border-color
54+
.app.dark &::-webkit-scrollbar-thumb
55+
background: lighten($dark-background-color, 7%);
56+
border: 1px solid lighten($dark-border-color, 7%)
5157
5258
// Keeping this here in case `overflow: overlay`
5359
// doesn't float everyone's boat.

src/devtools/components/SplitPane.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ export default {
5757
5858
.left
5959
border-right 1px solid $border-color
60+
.app.dark &
61+
border-right 1px solid $dark-border-color
6062
6163
.dragger
6264
position absolute

src/devtools/views/components/ComponentInstance.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default {
112112
position relative
113113
overflow hidden
114114
z-index 2
115-
background-color #fff
115+
background-color $background-color
116116
transition background-color .1s ease
117117
border-radius 3px
118118
font-size 14px
@@ -129,6 +129,8 @@ export default {
129129
border-left-color #fff
130130
.instance-name
131131
color #fff
132+
.app.dark &
133+
background-color $dark-background-color
132134
133135
.children
134136
position relative

src/devtools/views/events/EventInspector.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export default {
4949
5050
section:not(:last-child)
5151
border-bottom 1px solid $border-color
52+
.app.dark &
53+
border-bottom 1px solid $dark-border-color
5254
5355
.component-name
5456
margin 0 10px

src/devtools/views/events/EventsHistory.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default {
9595
cursor pointer
9696
padding 10px 20px
9797
font-size 12px
98-
background-color #fff
98+
background-color $background-color
9999
box-shadow 0 1px 5px rgba(0,0,0,.12)
100100
.event-name
101101
font-weight 600
@@ -115,6 +115,8 @@ export default {
115115
color: #fff
116116
.event-source
117117
color #ddd
118+
.app.dark &
119+
background-color $dark-background-color
118120
119121
.time
120122
font-size 11px

src/devtools/views/vuex/VuexHistory.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ $inspected_color = #af90d5
145145
cursor pointer
146146
padding 10px 20px
147147
font-size 12px
148-
background-color #fff
148+
background-color $background-color
149149
box-shadow 0 1px 5px rgba(0,0,0,.12)
150150
height 40px
151151
&.active
@@ -179,6 +179,8 @@ $inspected_color = #af90d5
179179
&:hover
180180
.entry-actions
181181
display inline-block
182+
.app.dark &
183+
background-color $dark-background-color
182184
183185
.action
184186
color #999

src/devtools/views/vuex/VuexStateInspector.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ function copyToClipboard (state) {
132132
top 1px
133133
font-size 12px
134134
color #c41a16
135-
background-color #fff
135+
background-color $background-color
136+
.app.dark &
137+
background-color $dark-background-color
136138
137139
.import-state
138140
transition all .3s ease
@@ -144,7 +146,11 @@ function copyToClipboard (state) {
144146
box-shadow 4px 4px 6px 0 $border-color
145147
border 1px solid $border-color
146148
padding 3px
147-
background-color #fff
149+
background-color $background-color
150+
.app.dark &
151+
background-color $dark-background-color
152+
box-shadow 4px 4px 6px 0 $dark-border-color
153+
border 1px solid $dark-border-color
148154
149155
textarea
150156
width 100%
@@ -153,4 +159,7 @@ function copyToClipboard (state) {
153159
outline none
154160
border none
155161
resize vertical
162+
.app.dark &
163+
color #DDD
164+
background-color $dark-background-color
156165
</style>

0 commit comments

Comments
 (0)