File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22Set your website theme here.
33*/
44
5- // Background
6- $primary-background : #cebada ;
7- $secondary-background : #048594 ;
8- $tertiary-background : #DB3069 ;
9-
10- // Foreground
11- $primary-foreground : #000000 ;
12- $secondary-foreground : #b81149 ;
13- $tertiary-foreground : #462749 ;
5+ $themes : (
6+ " light" : (
7+ " primary-bg" : #ffffff ,
8+ " secondary-bg" : #7dd4db ,
9+ " tertiary-bg" : #4fb9c1 ,
10+ " primary-fg" : #000000 ,
11+ " secondary-fg" : #9b4d5f ,
12+ " tertiary-fg" : #b85b74 ,
13+ ),
14+ " dark" : (
15+ " primary-bg" : #2e2c2c ,
16+ " secondary-bg" : #10555a ,
17+ " tertiary-bg" : #1c8991 ,
18+ " primary-fg" : #ffffff ,
19+ " secondary-fg" : #e90e0e ,
20+ " tertiary-fg" : #fd4c4c ,
21+ ),
22+ );
1423
1524// Font
1625$font-stack : Helvetica , Arial , sans-serif ;
Original file line number Diff line number Diff line change 33 < div class ="author-name-nav ">
44 < li > < a href ="/ "> {{author_name}}</ a > </ li >
55 </ div >
6+ < div class ="theme-switch ">
7+ < button id ="theme-toggle " onclick ="toggleTheme() ">
8+ < i class ="fas fa-moon "> </ i >
9+ </ button >
10+ </ div >
611 < a class ="burger-nav " onclick ="myFunction() ">
712 < i class ="fa-2x fa fa-bars "> </ i >
813 </ a >
Original file line number Diff line number Diff line change 55 {{ if hascode }}
66 {{ insert basic/foot_highlight.html }}
77 {{ end }}
8- < script src ="/assets/scripts/js/nav.js "> </ script >
8+ < script src ="/libs/buttons/nav.js "> </ script >
9+ < script src ="/libs/buttons/theme.js "> </ script >
910 </ body>
1011</ html>
Original file line number Diff line number Diff line change 11<!doctype html>
2- < html lang ="en ">
2+ < html lang ="en " data-theme =" light " >
33< head >
44 < meta charset ="UTF-8 ">
55 < meta name ="viewport " content ="width=device-width, initial-scale=1 ">
Original file line number Diff line number Diff line change 1+ function myFunction ( ) {
2+ var x = document . getElementById ( "hidden" ) ;
3+ if ( x . style . display === "block" ) {
4+ x . style . display = "none" ;
5+ } else {
6+ x . style . display = "block" ;
7+ }
8+ }
Original file line number Diff line number Diff line change 1+ function toggleTheme ( ) {
2+ const html = document . documentElement ;
3+ const themeToggle = document . getElementById ( "theme-toggle" ) ;
4+ const currentTheme = html . getAttribute ( "data-theme" ) ;
5+ const icon = themeToggle . querySelector ( "i" ) ;
6+
7+ if ( currentTheme === "dark" ) {
8+ html . setAttribute ( "data-theme" , "light" ) ;
9+ icon . className = "fas fa-moon" ;
10+ localStorage . setItem ( "theme" , "light" ) ;
11+ } else {
12+ html . setAttribute ( "data-theme" , "dark" ) ;
13+ icon . className = "fas fa-sun" ;
14+ localStorage . setItem ( "theme" , "dark" ) ;
15+ }
16+ }
17+
18+ // Check for saved theme preference
19+ document . addEventListener ( "DOMContentLoaded" , ( ) => {
20+ const savedTheme = localStorage . getItem ( "theme" ) ;
21+ const html = document . documentElement ;
22+ const themeToggle = document . getElementById ( "theme-toggle" ) ;
23+ const icon = themeToggle . querySelector ( "i" ) ;
24+
25+ if ( savedTheme === "dark" ) {
26+ html . setAttribute ( "data-theme" , "dark" ) ;
27+ icon . className = "fas fa-sun" ;
28+ }
29+ } ) ;
Original file line number Diff line number Diff line change 1414
1515body {
1616 overflow-x : hidden ;
17- background-color : theme . $ primary-background ;
17+ background-color : var ( -- primary-bg ) ;
1818}
1919
2020html {
2121 font-family : theme .$font-stack ;
2222 font-size : theme .$normal-font ;
23- color : theme . $ primary-foreground ;
23+ color : var ( -- primary-fg ) ;
2424}
2525
2626.franklin-content {
@@ -134,12 +134,12 @@ html {
134134 text-align : center ;
135135 align-content : center ;
136136 font-size : theme .$medium-font ;
137- color : theme . $ tertiary-foreground ;
137+ color : var ( -- tertiary-fg ) ;
138138}
139139
140140.short-bio {
141141 font-size : theme .$normal-font ;
142- color : theme . $ primary-foreground ;
142+ color : var ( -- primary-fg ) ;
143143}
144144
145145.page-foot {
Original file line number Diff line number Diff line change 11/*
22Variables to be used throughout site
33*/
4- @use " ../_assets/theme.scss" ;
4+ @use " ../_assets/theme" as user_theme ;
5+
6+ @each $theme , $colors in user_theme .$themes {
7+ [data-theme = " #{$theme } " ] {
8+ @each $name , $color in $colors {
9+ -- #{$name } : #{$color } ;
10+ }
11+ }
12+ }
513
614// Screens
715$mobile-max-width : 480px !default ;
Original file line number Diff line number Diff line change 55 width : 100% ;
66 height : 35% ;
77 padding : 5px ;
8- box-shadow : 0 0 8px 4px theme . $ tertiary-background ;
9- border : 2px solid theme . $ primary-foreground ;
8+ box-shadow : 0 0 8px 4px var ( -- tertiary-bg ) ;
9+ border : 2px solid var ( -- primary-fg ) ;
1010 display : flex ;
1111
1212 .card-img {
3030 text-align : left ;
3131
3232 .title {
33- color : theme . $ secondary-foreground ;
33+ color : var ( -- secondary-fg ) ;
3434 }
3535 }
3636}
Original file line number Diff line number Diff line change @@ -68,13 +68,13 @@ body {
6868 width : auto ;
6969 padding : 10px ;
7070 display : inline ;
71- color : theme . $ primary-foreground ;
72- background-color : theme . $ primary-background ;
71+ color : var ( -- primary-fg ) ;
72+ background-color : var ( -- primary-bg ) ;
7373 border : none ;
7474 align-content : center ;
7575
7676 a {
77- color : theme . $ primary-foreground ;
77+ color : var ( -- primary-fg ) ;
7878 font-size : theme .$xlarge-font ;
7979 text-decoration : none ;
8080 }
@@ -91,13 +91,13 @@ body {
9191 width : auto ;
9292 padding : 10px ;
9393 display : inline ;
94- color : theme . $ primary-foreground ;
95- background-color : theme . $ primary-background ;
94+ color : var ( -- primary-fg ) ;
95+ background-color : var ( -- primary-bg ) ;
9696 border : none ;
9797 align-content : center ;
9898
9999 a {
100- color : theme . $ primary-foreground ;
100+ color : var ( -- primary-fg ) ;
101101 font-size : theme .$xlarge-font ;
102102 text-decoration : none ;
103103 }
You can’t perform that action at this time.
0 commit comments