diff --git a/README.md b/README.md index 9d6c99f..8fe19c0 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ This is the code for my personal website and resume. The main branch of this rep ## Cool things that I never get to brag about * The header section of the website always correctly indicates my age, as long as you have JavaScript enabled. It will calculate and display my age based on my most recent birthday. -* There is a dark mode in this website, accessible by typing `clapoff`. Light mode can be restored by typing `clapon`. +* There is a dark mode in this website, accessible by typing `dark`. Light mode can be restored by typing `lite`. Other color modes are also available -- `purp`, `yell`, `blue`, `mint` at least. See `js/script.js` for an exhaustive list. Your preference can be stored permanently by typing `save`. * I spent a decent amount of time worrying about accessibility in the later iterations of this website, so hopefully that should not be an issue for anyone. If there's anything I can do to improve on that front, please let me know. ## License diff --git a/css/style.css b/css/style.css index b347678..4ced717 100644 --- a/css/style.css +++ b/css/style.css @@ -10,36 +10,59 @@ html { body { margin: 0; font-family: "Nunito", sans-serif; + background: var(--bgColor); +} +@media (prefers-color-scheme: light) { + body { + --bgColor: white; + --textColor: #777; + --iconColor: black; + --boldColor: black; + } +} +@media (prefers-color-scheme: dark) { + body { + --bgColor: black; + --iconColor: white; + --textColor: #aaa; + --boldColor: white; + } +} +body.lite-mode { + --bgColor: white; + --textColor: #777; + --iconColor: black; + --boldColor: black; } - body.dark-mode { - background: black; - color: white; + --bgColor: black; + --iconColor: white; + --textColor: #aaa; + --boldColor: white; } -body.dark-mode .bg { - opacity: 0 !important; +body.mint-mode { + --bgColor: #c7fcee; + --iconColor: #486b61; + --textColor: #5f8c80; + --boldColor: #10352b; } -body.dark-mode .main h1 { - color: #fff; +body.purp-mode { + --bgColor: #cfc7fc; + --iconColor: #5a518c; + --textColor: #7166af; + --boldColor: #312c4c; } -body.dark-mode .main em { - color: #fff; +body.yell-mode { + --bgColor: #fcfcbf; + --iconColor: #54543f; + --textColor: #8c8c5f; + --boldColor: #353528; } -body.dark-mode .main h3 { - color: #aaa; -} -body.dark-mode .main h3 a { - color: #fff; -} -body.dark-mode .main h3 a:before, body.dark-mode .main h3 a:after { - background: rgba(255, 255, 255, 0.2); -} -body.dark-mode .main h3 a.among { - color: inherit; -} -body.dark-mode .main a.contact-method p { - color: #fff; - font-size: 1rem; +body.blue-mode { + --bgColor: #ade3ff; + --iconColor: #394b54; + --textColor: #46748c; + --boldColor: #242f35; } .main { @@ -69,43 +92,35 @@ body.dark-mode .main a.contact-method p { font-size: 4rem; font-weight: 600; margin: 0 0 2rem; - color: #000; + color: var(--boldColor); } .main h3 { margin: 1rem 0 0; font-size: 1.7rem; line-height: 1.4; font-weight: normal; - color: #777; + color: var(--textColor); } .main em { - color: #000; + color: var(--boldColor); font: inherit; } .main h3 a { - color: #000; + color: var(--boldColor); text-decoration: none; border-bottom: 0.2rem solid transparent; white-space: nowrap; position: relative; } -.main h3 a.among { - color: inherit; - border-bottom: 0; - cursor: text; -} -.main h3 a.among:before, .main h3 a.among:after { - content: none; -} .main h3 a:before, .main h3 a:after { content: ""; bottom: 0.4rem; left: 0; width: 100%; height: 0.1rem; - background: rgba(51, 51, 51, 0.2); + background: var(--boldColor); position: absolute; - opacity: 0.2; + opacity: 0.04; transition: all 0.2s ease; } .main h3 a:before { @@ -113,11 +128,19 @@ body.dark-mode .main a.contact-method p { transform-origin: center left; } .main h3 a:after { - opacity: 0.5; + opacity: 0.1; } .main h3 a:hover:before { transform: scaleX(1); - opacity: 1; + opacity: 0.2; +} +.main h3 button { + color: inherit; + font: inherit; + margin: 0; + padding: 0; + border: 0; + background: none; } .main .contact-methods { display: flex; @@ -132,6 +155,9 @@ body.dark-mode .main a.contact-method p { width: 4rem; height: 4rem; } +.main .contact-methods a.contact-method i { + color: var(--iconColor); +} .main .contact-methods a.contact-method p { margin: 0; position: absolute; @@ -219,6 +245,7 @@ body.dark-mode .main a.contact-method p { pointer-events: none; transition: none; opacity: 0; + color: var(--boldColor); } .clapper.clapping { diff --git a/css/style.scss b/css/style.scss index 70ca7d6..e189918 100644 --- a/css/style.scss +++ b/css/style.scss @@ -10,45 +10,62 @@ html { body { margin: 0; font-family: 'Nunito', sans-serif; -} + background: var(--bgColor); -body.dark-mode { - background: black; - color: white; - - .bg { - opacity: 0 !important; + @media(prefers-color-scheme: light) { + --bgColor: white; + --textColor: #777; + --iconColor: black; + --boldColor: black; } - .main { - h1 { - color: #fff; - } + @media(prefers-color-scheme: dark) { + --bgColor: black; + --iconColor: white; + --textColor: #aaa; + --boldColor: white; + } - em { - color: #fff; - } + &.lite-mode { + --bgColor: white; + --textColor: #777; + --iconColor: black; + --boldColor: black; + } - h3 { - color: #aaa; - } + &.dark-mode { + --bgColor: black; + --iconColor: white; + --textColor: #aaa; + --boldColor: white; + } - h3 a { - color: #fff; + &.mint-mode { + --bgColor: #c7fcee; + --iconColor: #486b61; + --textColor: #5f8c80; + --boldColor: #10352b; + } - &:before, &:after { - background: rgba(#fff, 0.2); - } + &.purp-mode { + --bgColor: #cfc7fc; + --iconColor: #5a518c; + --textColor: #7166af; + --boldColor: #312c4c; + } - &.among { - color: inherit; - } - } + &.yell-mode { + --bgColor: #fcfcbf; + --iconColor: #54543f; + --textColor: #8c8c5f; + --boldColor: #353528; + } - a.contact-method p { - color: #fff; - font-size: 1rem; - } + &.blue-mode { + --bgColor: #ade3ff; + --iconColor: #394b54; + --textColor: #46748c; + --boldColor: #242f35; } } @@ -83,7 +100,7 @@ body.dark-mode { font-size: 4rem; font-weight: 600; margin: 0 0 2rem; - color: #000; + color: var(--boldColor); } h3 { @@ -91,39 +108,30 @@ body.dark-mode { font-size: 1.7rem; line-height: 1.4; font-weight: normal; - color: #777; + color: var(--textColor); } em { - color: #000; + color: var(--boldColor); font: inherit; } h3 a { - color: #000; + color: var(--boldColor); text-decoration: none; border-bottom: 0.2rem solid transparent; white-space: nowrap; position: relative; - &.among { - color: inherit; - border-bottom: 0; - &:before, &:after { - content: none; - } - cursor: text; - } - &:before, &:after { content: ''; bottom: 0.4rem; left: 0; width: 100%; height: 0.1rem; - background: rgba(#333, 0.2); + background: var(--boldColor); position: absolute; - opacity: 0.2; + opacity: 0.04; transition: all 0.2s ease; } @@ -133,15 +141,24 @@ body.dark-mode { } &:after { - opacity: 0.5; + opacity: 0.1; } &:hover:before { transform: scaleX(1); - opacity: 1; + opacity: 0.2; } } + h3 button { + color: inherit; + font: inherit; + margin: 0; + padding: 0; + border: 0; + background: none; + } + .contact-methods { display: flex; margin-left: -1.5rem; @@ -155,6 +172,10 @@ body.dark-mode { width: 4rem; height: 4rem; + i { + color: var(--iconColor); + } + p { margin: 0; position: absolute; @@ -258,6 +279,7 @@ body.dark-mode { pointer-events: none; transition: none; opacity: 0; + color: var(--boldColor); } .clapper.clapping { diff --git a/index.html b/index.html index dc73dd9..bf21515 100644 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@