Skip to content

Commit c66ffa2

Browse files
committed
Dark mode added
1 parent 71c9572 commit c66ffa2

File tree

4 files changed

+92
-8
lines changed

4 files changed

+92
-8
lines changed

Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ RUN . ~/.nvm/nvm.sh install 13
66
RUN . ~/.nvm/nvm.sh use 13
77
RUN apt update
88
RUN apt install -y python2
9-
RUN python2 -v
9+
WORKDIR /app
10+
COPY package.json .
11+
RUN yarn
1012

1113
FROM base AS build
1214
WORKDIR /app
13-
COPY package.json .
14-
RUN npm install
1515
COPY . .

index.html

+25-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
88
<link rel="stylesheet" href="dist/csh-material-bootstrap.css" media="screen">
99
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css">
10+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined" rel="stylesheet">
1011
<style>
1112
body{padding-top:120px}pre{background:#f7f7f9}@media (min-width: 768px){body>.navbar-transparent{box-shadow:none}body>.navbar-transparent .navbar-nav>.open>a{box-shadow:none}}#home,#help{font-size:0.9rem}#home .navbar,#help .navbar{background:#349aed;background:linear-gradient(145deg, #349aed 50%, #34d8ed 100%);transition:box-shadow 200ms ease-in}#home .navbar-transparent,#help .navbar-transparent{background:none !important;box-shadow:none}#home .navbar-brand .nav-link,#help .navbar-brand .nav-link{display:inline-block;margin-right:-30px}#home .navbar-brand img,#help .navbar-brand img{display:inline-block;margin:0 10px;width:30px}#home .nav-link,#help .nav-link{text-transform:uppercase;font-weight:500;color:#fff}#home{padding-top:0px}#home .btn{padding:0.6rem 0.55rem 0.5rem;box-shadow:none;font-size:0.7rem;font-weight:500}.bs-docs-section{margin-top:4em}.bs-docs-section .page-header h1{padding:2rem 0;font-size:3rem}.dropdown-menu.show[aria-labelledby="themes"]{display:flex;width:420px;flex-wrap:wrap}.dropdown-menu.show[aria-labelledby="themes"] .dropdown-item{width:33.333%}.dropdown-menu.show[aria-labelledby="themes"] .dropdown-item:first-child{width:100%}.bs-component{position:relative}.bs-component+.bs-component{margin-top:1rem}.bs-component .card{margin-bottom:1rem}.bs-component .modal{position:relative;top:auto;right:auto;left:auto;bottom:auto;z-index:1;display:block}.bs-component .modal-dialog{width:90%}.bs-component .popover{position:relative;display:inline-block;width:220px;margin:20px}.source-button{display:none;position:absolute;top:0;right:0;z-index:100;font-weight:bold}.source-button:hover{cursor:pointer}.bs-component:hover .source-button{display:block}#source-modal pre{max-height:calc(100vh - 11rem);background-color:rgba(0,0,0,0.7);color:rgba(255,255,255,0.7)}.nav-tabs{margin-bottom:15px}.progress{margin-bottom:10px}#footer{margin:5em 0}#footer li{float:left;margin-right:1.5em;margin-bottom:1.5em}#footer p{clear:left;margin-bottom:0}.splash{padding:12em 0 6em;background:#349aed;background:linear-gradient(145deg, #349aed 50%, #34d8ed 100%);color:#fff;text-align:center}.splash .logo{width:160px}.splash h1{font-size:3em;color:#fff}.splash #social{margin:2em 0 3em}.splash .alert{margin:2em 0;border:none}.splash .sponsor a{color:#fff}.section-tout{padding:6em 0 1em;border-bottom:1px solid rgba(0,0,0,0.05);background-color:#eaf1f1;text-align:center}.section-tout .icon{text-align:center;margin-bottom:1rem}.section-tout .fa{display:inline-block;padding:0.8em;font-size:2rem;background:#349aed;background:linear-gradient(145deg, #3b9cea 50%, #3db8eb 100%);border-radius:50%;color:rgba(0,0,0,0.5)}.section-tout p{margin-bottom:5em}.section-preview{padding:4em 0 4em}.section-preview .preview{margin-bottom:4em;background-color:#eaf1f1}.section-preview .preview img{max-width:100%}.section-preview .preview .image{position:relative}.section-preview .preview .image:before{box-shadow:inset 0 0 0 1px rgba(0,0,0,0.1);position:absolute;top:0;left:0;width:100%;height:100%;content:"";pointer-events:none}.section-preview .preview .options{padding:2em;border:1px solid rgba(0,0,0,0.05);border-top:none;text-align:center}.section-preview .preview .options p{margin-bottom:2em}.section-preview .dropdown-menu{text-align:left}.section-preview .lead{margin-bottom:2em}@media (max-width: 767px){.section-preview .image img{width:100%}}.sponsor img{max-width:100%}.sponsor #carbonads{max-width:240px;margin:0 auto}.sponsor .carbon-text{display:block;margin-top:1em;font-size:12px}.sponsor .carbon-poweredby{float:right;margin-top:1em;font-size:10px}@media (max-width: 767px){.splash{padding-top:8em}.splash .logo{width:100px}.splash h1{font-size:2em}#banner{margin-bottom:2em;text-align:center}}
1213
</style>
@@ -35,6 +36,7 @@
3536
</li>
3637
</ul>
3738
</div>
39+
<div id="theme-indicator"></div>
3840
</div>
3941
</div>
4042

@@ -1559,7 +1561,7 @@ <h4 class="modal-title">Source Code</h4>
15591561
</ul>
15601562
<p>Made by <a href="https://csh.rit.edu">Computer Science House</a>.</p>
15611563
<p>Code released under the <a href="https://github.com/ComputerScienceHouse/csh-material-bootstrap/blob/master/LICENSE">MIT License</a>.</p>
1562-
<p>Based on <a href="https://bootswatch.com/materia" rel="nofollow">Materia</a> by <a href="https://bootswatch.com" rel="nofollow">Bootswatch</a>. Icons from <a href="http://fontawesome.io/" rel="nofollow">Font Awesome</a>. Web fonts from <a href="https://fonts.google.com/" rel="nofollow">Google</a>.</p>
1564+
<p>Based on <a href="https://bootswatch.com/materia" rel="nofollow">Materia</a> by <a href="https://bootswatch.com" rel="nofollow">Bootswatch</a>. Icons and web fonts from <a href="https://fonts.google.com/" rel="nofollow">Google</a>.</p>
15631565
</div>
15641566
</div>
15651567
</footer>
@@ -1632,5 +1634,27 @@ <h4 class="modal-title">Source Code</h4>
16321634

16331635
hljs.initHighlightingOnLoad();
16341636
</script>
1637+
<script>
1638+
const themeIndicator = document.getElementById("theme-indicator");
1639+
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)');
1640+
if (prefersDarkScheme.matches) {
1641+
document.body.classList.add('dark-theme');
1642+
themeIndicator.innerHTML = '<span class="material-icons-outlined">dark_mode</span>';
1643+
} else {
1644+
document.body.classList.remove('dark-theme');
1645+
themeIndicator.innerHTML = '<span class="material-icons-outlined">light_mode</span>';
1646+
}
1647+
1648+
themeIndicator.onclick = function() {
1649+
if (themeIndicator.firstChild.innerHTML == "dark_mode") {
1650+
document.body.classList.remove('dark-theme');
1651+
themeIndicator.innerHTML = '<span class="material-icons-outlined">light_mode</span>';
1652+
} else {
1653+
document.body.classList.add('dark-theme');
1654+
themeIndicator.innerHTML = '<span class="material-icons-outlined">dark_mode</span>';
1655+
}
1656+
}
1657+
1658+
</script>
16351659
</body>
16361660
</html>

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "csh-material-bootstrap",
33
"description": "A material design Bootstrap theme for Computer Science House.",
4-
"version": "4.5.2",
4+
"version": "4.6.2",
55
"author": "Computer Science House <[email protected]>",
66
"homepage": "https://csh.rit.edu",
77
"license": "MIT",

src/csh-material-bootstrap.scss

+63-3
Original file line numberDiff line numberDiff line change
@@ -768,12 +768,72 @@ select.form-control {
768768
}
769769
}
770770

771+
// THEME INDICATOR ===============
772+
773+
#theme-indicator {
774+
display: block;
775+
width: 32px;
776+
height: 32px;
777+
fill: var(--dark);
778+
}
771779

772780
// DARK THEME =============================
773781

774782
.dark-theme {
775-
body {
776-
background-color: rgb(34, 34, 34);
777-
color: #eee;
783+
background-color: rgb(34, 34, 34);
784+
color: #eee;
785+
}
786+
.dark-theme * {
787+
788+
--secondary: #aaa;
789+
--light: #eee;
790+
791+
#theme-indicator {
792+
fill: var(--light);
793+
794+
}
795+
796+
.bg-secondary {
797+
background-color: #444 !important;
798+
}
799+
800+
.jumbotron {
801+
background-color: rgb(43, 43, 43);
802+
}
803+
804+
tr:not([class]),
805+
tr.table-active,
806+
tr:not([class]):hover,
807+
tr.table-active:hover {
808+
color: #eee;
809+
}
810+
811+
.form-control::placeholder, .form-control-plaintext {
812+
color: #666;
813+
}
814+
815+
.text-muted {
816+
color: #aaa !important;
817+
}
818+
819+
.modal-content {
820+
background-color: #262626;
821+
}
822+
823+
.toast-body {
824+
color: #444;
825+
}
826+
827+
.card:not(.text-white) {
828+
color: #444;
829+
}
830+
831+
.nav-tabs .nav-link {
832+
color: #aaa;
833+
}
834+
835+
.btn-secondary.disabled {
836+
color: #555;
778837
}
838+
779839
}

0 commit comments

Comments
 (0)