Skip to content

Commit f7fd288

Browse files
avinashsharma080Avinash Sharmavfdev-5
authored
added HTML and CSS and JS for dark Mode button (#347)
* added HTML and CSS for dark Mode button * commit to check how dark mode can be added * added dark mode CSS support * added dark mode CSS support * default dark mode design * Fixed dark mode css * added dark mode css for nebari,handler and loggers * added dark mode css for nebari,handler and loggers * Fixed JS for white/dark mode toggle * Resolved suggested changes * Update src/App.vue * Formatted code * Refactored code for Vue * Refactored code for Vue * Refactored code for Vue * Refactored and removed unused css * Refactored and removed unused css * refactored code * Changed code to use Vuejs v-show property --------- Co-authored-by: Avinash Sharma <[email protected]> Co-authored-by: vfdev <[email protected]>
1 parent b444342 commit f7fd288

11 files changed

+225
-21
lines changed

src/App.vue

+26-1
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
box-sizing: border-box;
1414
border-width: 0;
1515
}
16+
1617
::selection {
1718
color: var(--c-white-light);
1819
background: var(--c-brand-red);
1920
}
21+
2022
:root {
2123
--c-white: #fff;
2224
--c-white-light: #f6f6f6;
@@ -33,43 +35,61 @@
3335
--code-line-height: 24px;
3436
--code-text-light: #476582;
3537
--code-inline-bg-color: rgba(27, 31, 35, 0.05);
38+
--accent-color: #cacaca;
39+
--background-color-primary: #fff;
40+
--background-color-secondary: #fafafa;
3641
}
42+
43+
:root.dark-theme {
44+
--background-color-primary: #1e1e1e;
45+
--background-color-secondary: #2d2d30;
46+
--c-text: white;
47+
--c-white-dark: #3f3f3f;
48+
}
49+
3750
body {
3851
font-family: var(--font-family-base);
3952
font-size: var(--font-size);
4053
line-height: 1.5;
4154
margin: 0;
4255
height: 100%;
4356
color: var(--c-text);
44-
background-color: var(--c-white);
57+
background-color: var(--background-color-primary);
4558
-webkit-font-smoothing: antialiased;
4659
-moz-osx-font-smoothing: grayscale;
4760
}
61+
4862
h1 {
4963
font-weight: 600;
5064
}
65+
5166
h2,
5267
h3,
5368
h4,
5469
h5,
5570
h6 {
5671
font-weight: 500;
5772
}
73+
5874
@media (max-width: 915px) {
5975
h1 {
6076
font-size: 1.5rem;
6177
}
78+
6279
h2 {
6380
font-size: 1.25rem;
6481
}
82+
6583
h3 {
6684
font-size: 1.125rem;
6785
}
6886
}
87+
6988
a {
7089
text-decoration: none;
7190
color: var(--c-text);
7291
}
92+
7393
@media (prefers-reduced-motion) {
7494
:focus {
7595
border-radius: 3px;
@@ -78,18 +98,21 @@ a {
7898
outline: 2px solid var(--c-brand-yellow);
7999
}
80100
}
101+
81102
/* margin for left pane tabs */
82103
.tab {
83104
--left-pane-margin-x: 1.5rem;
84105
margin: 0 var(--left-pane-margin-x);
85106
padding-bottom: 2rem;
86107
}
108+
87109
/* overriding prismjs defaults */
88110
pre,
89111
code {
90112
font-family: var(--code-font-family) !important;
91113
font-size: var(--code-font-size) !important;
92114
}
115+
93116
/* for three backticks code block */
94117
code {
95118
margin: 0;
@@ -98,10 +121,12 @@ code {
98121
color: var(--code-text-light);
99122
background-color: var(--code-inline-bg-color);
100123
}
124+
101125
.slide-fade-leave-active,
102126
.slide-fade-enter-active {
103127
transition: all 0.25s ease-out;
104128
}
129+
105130
.slide-fade-enter-from,
106131
.slide-fade-leave-to {
107132
transform: translateY(10px);

src/components/FormInput.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ input[type='text'],
103103
input[type='number'] {
104104
border-radius: 3px 3px 0 0;
105105
border: 1px solid var(--c-white-light);
106-
background: var(--c-white-light);
106+
background: var(--background-color-secondary);
107+
color: var(--c-text);
107108
padding: 0.5rem 1rem;
108109
width: 100%;
109110
}
@@ -120,7 +121,7 @@ input[type='number'] ~ .expand {
120121
input[type='text']:focus,
121122
input[type='number']:focus {
122123
outline: none;
123-
background: var(--c-white);
124+
background: var(--background-color-secondary);
124125
}
125126
input[type='text']:focus ~ .expand,
126127
input[type='number']:focus ~ .expand {

src/components/FormSelect.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function toTitleCase(v) {
9595
-webkit-appearance: none;
9696
-moz-appearance: none;
9797
appearance: none;
98-
background: var(--c-white-light);
99-
border-radius: 3px;
98+
background: var(--background-color-secondary);
99+
border-radius: 3px solid var(--c-text);
100100
color: var(--c-text);
101101
cursor: pointer;
102102
font-family: var(--font-family-base);

src/components/NavBar.vue

+5-4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
v{{ version }}@{{ currentCommit.slice(0, 7) }}
2828
</a>
2929
<NavContributors />
30+
<NavToggleDarkMode />
3031
</div>
3132
</nav>
3233
</template>
@@ -42,7 +43,7 @@ import NavIgniteDocs from './NavIgniteDocs.vue'
4243
import NavTwitter from './NavTwitter.vue'
4344
import NavHelp from './NavHelp.vue'
4445
import NavContributors from './NavContributors.vue'
45-
46+
import NavToggleDarkMode from './NavToggleDarkMode.vue'
4647
export default {
4748
components: {
4849
NavDiscord,
@@ -53,11 +54,11 @@ export default {
5354
NavTwitter,
5455
NavHelp,
5556
NavIgniteDocs,
56-
NavContributors
57+
NavContributors,
58+
NavToggleDarkMode
5759
},
5860
setup() {
5961
const currentCommit = __COMMIT__ // from vite.config.js
60-
6162
return { version, currentCommit }
6263
}
6364
}
@@ -97,7 +98,7 @@ h1 img {
9798
z-index: 6;
9899
width: 100%;
99100
padding: 0.5rem 0.5rem 0;
100-
background-color: var(--c-white);
101+
background-color: var(--background-color-primary);
101102
}
102103
}
103104
</style>

src/components/NavCode.vue

+13-4
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,18 @@ export default {
234234
color: white;
235235
text-align: center;
236236
}
237+
237238
/* Dropdown Content (Hidden by Default) */
238239
.dropdown-content {
239240
display: none;
240241
position: absolute;
241-
background-color: var(--c-white-light);
242+
background-color: var(--background-color-primary);
242243
min-width: 15vw;
243244
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
244245
z-index: 1;
245246
padding: 0.5vh;
246-
text-align: center; /* Center-align the dropdown content */
247+
text-align: center;
248+
/* Center-align the dropdown content */
247249
border: 1px solid var(--c-brand-red);
248250
border-radius: 3%;
249251
text-align: -webkit-center;
@@ -272,21 +274,26 @@ export default {
272274
align-self: center;
273275
margin-left: 1.1vw;
274276
}
277+
275278
.generate {
276-
background-color: #ffffff;
279+
background-color: var(--background-color-primary);
277280
width: 80%;
278281
font-size: 60%;
279282
height: 1.5rem;
280283
}
284+
281285
#text-box {
282286
font-size: 90%;
283287
height: 1.6rem;
284288
border-radius: 3%;
289+
color: var(--c-text);
290+
background: var(--background-color-primary);
285291
}
286292

287293
.icon {
288294
vertical-align: bottom;
289295
}
296+
290297
.inline-icon {
291298
display: inline-flex;
292299
vertical-align: bottom;
@@ -302,7 +309,7 @@ export default {
302309
}
303310

304311
.copy-link-input:hover {
305-
background: var(--c-brand-red);
312+
background: var(--c-brand-red) !important;
306313
border: 1px solid #cccccc;
307314
color: #f1f1f1;
308315
}
@@ -335,9 +342,11 @@ export default {
335342
display: block;
336343
z-index: 10;
337344
}
345+
338346
.copy-button {
339347
font-size: 1rem;
340348
}
349+
341350
.wget-text {
342351
font-size: 0.6em;
343352
}

src/components/NavContributors.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export default {
116116
}
117117
.contributors-wrapper div {
118118
padding: 1rem 0;
119-
background-color: var(--c-white-light);
119+
background-color: var(--background-color-primary);
120120
font-size: var(--font-size);
121121
color: var(--c-text);
122122
border-radius: 8px;

src/components/NavHelp.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ export default {
9191
}
9292
.help-wrapper div {
9393
padding: 1rem 0;
94-
background-color: var(--c-white-light);
94+
background-color: var(--background-color-primary);
9595
font-size: var(--font-size);
9696
color: var(--c-text);
9797
border-radius: 8px;

src/components/NavNebari.vue

+8-4
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ export default {
254254
.dropdown-content {
255255
display: none;
256256
position: absolute;
257-
background-color: var(--c-white-light);
257+
background-color: var(--background-color-primary);
258258
min-width: 15vw;
259259
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
260260
z-index: 100;
@@ -303,7 +303,7 @@ export default {
303303
}
304304
.code-snippet {
305305
text-align: center;
306-
background-color: #cccccc;
306+
background-color: var(--c-white-dark);
307307
}
308308

309309
/* Text Box CSS */
@@ -316,14 +316,16 @@ export default {
316316
font-size: larger;
317317
}
318318
.text-box-nebari-details {
319+
background: var(--background-color-secondary);
320+
color: var(--c-text);
319321
width: 95%;
320322
height: 3vh;
321323
}
322324

323325
.copy-link-input:hover {
324-
background: var(--c-brand-red);
326+
background: var(--c-brand-red) !important;
325327
border: 1px solid #cccccc;
326-
color: #f1f1f1;
328+
color: black;
327329
}
328330

329331
#nebari-bottom-button {
@@ -336,6 +338,8 @@ export default {
336338
margin: 2.8vh;
337339
margin-top: 3vh;
338340
margin-bottom: 2vh;
341+
background: var(--background-color-primary);
342+
color: var(--c-text);
339343
}
340344
.copy-button-nebari {
341345
font-size: 1rem;

0 commit comments

Comments
 (0)