From cfc0a2dcf30619773ac5ba8545dfe8bccc74cf13 Mon Sep 17 00:00:00 2001 From: Teddy Gustiaux Date: Mon, 5 Feb 2024 22:12:33 -0500 Subject: [PATCH] add: automatic dark mode for quick bookmarking to folder popup --- src/css/variables.css | 33 +++++++ src/icons/browser-action/settings.svg | 51 +---------- src/popup/popup.css | 119 +++++++++++++++----------- src/popup/popup.html | 3 +- src/popup/popup.js | 18 +++- 5 files changed, 122 insertions(+), 102 deletions(-) create mode 100644 src/css/variables.css diff --git a/src/css/variables.css b/src/css/variables.css new file mode 100644 index 00000000..e728e27d --- /dev/null +++ b/src/css/variables.css @@ -0,0 +1,33 @@ +:root { + --primary-color: #3273dc; + --font-color: #4a4a4a; + --font-color-focus: #363636; + --font-color-navbar: #4a4a4a; + --font-color-error: hsl(348, 86%, 61%); + --bg-color: #fff; + --bg-color-alternate: #f5f5f5; + --bg-color-notification: var(--bg-color-alternate); + --bg-color-notification-global: var(--bg-color-alternate); + --bg-color-box: var(--bg-color); + --bg-color-box-shadow: rgba(10, 10, 10, 0.1); + --bg-color-navbar-active: #e8e8e8; + --article-border-color: #dbdbdb; +} + +@media (prefers-color-scheme: dark) { + :root { + --primary-color: #209cee; + --font-color: #fff; + --font-color-focus: #f3f3f3; + --font-color-navbar: #2d2d2d; + --font-color-error: hsl(348, 86%, 61%); + --bg-color: #2d2d2d; + --bg-color-alternate: #4a4a4a; + --bg-color-notification: var(--bg-color-alternate); + --bg-color-notification-global: var(--bg-color-alternate); + --bg-color-box: var(--bg-alternate); + --bg-color-box-shadow: rgba(240, 240, 240, 0.1); + --bg-color-navbar-active: #e8e8e8; + --article-border-color: #dbdbdb; + } +} diff --git a/src/icons/browser-action/settings.svg b/src/icons/browser-action/settings.svg index a69072f4..fdcbc428 100644 --- a/src/icons/browser-action/settings.svg +++ b/src/icons/browser-action/settings.svg @@ -1,52 +1,5 @@ - - - - - - image/svg+xml - - - - - - + + /> diff --git a/src/popup/popup.css b/src/popup/popup.css index b13d5da4..77ef2345 100644 --- a/src/popup/popup.css +++ b/src/popup/popup.css @@ -1,91 +1,108 @@ +@import '/css/variables.css'; + body { - font-family: "Open Sans", sans-serif; + font-family: 'Open Sans', sans-serif; + background-color: var(--bg-color-alternate); + color: var(--font-color); } .banner { - background-color: #f2f2f2; - margin: 0; - padding: 0; - width: 100%; + background-color: var(--bg-color-alternate); + margin: 0; + padding: 0; + width: 100%; } .content { - margin-top: 0rem; - margin-bottom: 1rem; - margin-right: 1rem; - margin-left: 1rem; - width: 90%; + background-color: var(--bg-color); + padding-top: 0rem; + padding-bottom: 1rem; + padding-right: 1rem; + padding-left: 1rem; } .banner .content { - display: flex; - justify-content: flex-end; - margin-top: 0.75rem; - margin-bottom: 0.75rem; - text-align: center; + background-color: var(--bg-color-alternate); + display: flex; + justify-content: flex-end; + padding-top: 0.75rem; + padding-bottom: 0.75rem; + text-align: center; } .disabled { - pointer-events: none; - opacity: 0.6; + pointer-events: none; + opacity: 0.6; } #open-settings { - padding: 0.5rem; - color: #f2f2f2; - background-color: #209CEE; - border: 1px solid transparent; - border-radius: 4px; - margin-top: 0rem; - font-family:inherit; - display: inline-flex; - align-items: center; + padding: 0.5rem; + color: var(--font-color-navbar); + background-color: var(--primary-color); + border: 1px solid transparent; + border-radius: 4px; + margin-top: 0rem; + font-weight: 500; + display: inline-flex; + align-items: center; +} + +.svg-icon-regular { + display: inline-flex; + align-self: center; } -#test { - height: 1.2rem; - margin-right: 0.5rem; +.svg-icon-regular svg { + height: 1.2rem; + width: 1.2rem; + fill: var(--font-color-navbar); } .search-info { - font-style: italic; + font-style: italic; } #search-input { - border-radius: 25px; - border: 5px solid #f2f2f2; - padding: 20px; - height: 15px; - font-weight: 600; - margin-bottom: 1.5rem; + border-radius: 25px; + border: 5px solid var(--bg-color-alternate); + background-color: var(--bg-color-alternate); + padding: 20px; + height: 15px; + font-weight: 600; + margin-bottom: 1.5rem; + color: var(--font-color); +} + +#search-input::placeholder { + color: var(--font-color); } #not-found { - display: none; - font-weight: 600; + display: none; + font-weight: 600; } #search-results { - list-style-type: none; - padding: 0; - margin: 0; + list-style-type: none; + padding: 0; + margin: 0; } #search-results li a { - display: block; - text-decoration: none; - font-size: 1rem; - border: 1px solid #f2f2f2; - margin-top: -1px; - padding: 1rem; + display: block; + text-decoration: none; + font-size: 1rem; + border: 1px solid var(--bg-color-alternate); + margin-top: -1px; + padding: 1rem; } #search-results li a:hover:not(.header) { - background-color: #f2f2f2; + background-color: var(--bg-color-alternate); } #save-error { - display: none; - color: hsl(348, 86%, 61%); - font-weight: 600; + display: none; + color: var(--font-color-error); + font-weight: 600; } diff --git a/src/popup/popup.html b/src/popup/popup.html index d25d6667..6324eac1 100644 --- a/src/popup/popup.html +++ b/src/popup/popup.html @@ -11,7 +11,8 @@