From ba4b7fdc3c82e68924a8c5841cfde0e2a589fed5 Mon Sep 17 00:00:00 2001 From: Ondrej Zara Date: Tue, 2 Apr 2019 19:52:53 +0200 Subject: [PATCH] settings --- app/app.css | 64 +++++++++++++++++++++++++++++++++++------- app/css/app.less | 8 ++++++ app/css/component.less | 2 +- app/css/settings.less | 23 +++++++++++++++ app/css/variables.less | 31 ++++++++++++++++---- app/index.html | 26 +++++++++++++++++ app/js/app.js | 3 +- app/js/lib/mpd.js | 5 +++- app/js/settings.js | 50 +++++++++++++++++++++++++++++++++ 9 files changed, 194 insertions(+), 18 deletions(-) create mode 100644 app/css/settings.less create mode 100644 app/js/settings.js diff --git a/app/app.css b/app/app.css index 213c918..4584bea 100644 --- a/app/app.css +++ b/app/app.css @@ -45,6 +45,12 @@ button { cursor: pointer; flex-shrink: 0; } +select { + background-color: transparent; + border: 1px solid var(--fg); + border-radius: 4px; + padding: 2px 4px; +} @font-face { font-family: 'Lato'; src: url('font/LatoLatin-Regular.woff2') format('woff2'); @@ -218,7 +224,7 @@ nav ul li.active { width: 32px; } .component li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } #queue { height: 100%; @@ -276,7 +282,7 @@ nav ul li.active { width: 32px; } #queue li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } #queue .current { color: var(--primary); @@ -337,7 +343,7 @@ nav ul li.active { width: 32px; } #library li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } #library header { white-space: pre; @@ -432,7 +438,7 @@ nav ul li.active { width: 32px; } #fs li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } #fs header { white-space: pre; @@ -510,7 +516,7 @@ nav ul li.active { width: 32px; } #playlists li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } #playlists .info { display: flex; @@ -578,7 +584,7 @@ nav ul li.active { width: 32px; } #yt li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } #yt .go { width: 96px; @@ -611,6 +617,27 @@ nav ul li.active { transform: rotate(360deg); } } +#settings dl { + margin: 8px; + display: grid; + grid-template-columns: max-content 1fr; + align-items: center; + grid-gap: 8px; +} +#settings dt { + font-weight: bold; +} +#settings dd { + margin: 0; + display: flex; + flex-direction: column; + align-items: start; +} +#settings label { + display: flex; + flex-direction: row; + align-items: center; +} .search { display: flex; flex-direction: row; @@ -645,10 +672,27 @@ nav ul li.active { vertical-align: top; } :root { - --primary: dodgerblue; - --fg: #fff; - --bg: #333; - --shadow: 0 1px 1px rgba(0, 0, 0, 0.8); --font-size-large: 112.5%; --icon-spacing: 4px; } +:root[data-theme=light] { + --fg: #000; + --bg: #fff; + --bg-alt: #eee; + --shadow: none; +} +:root[data-theme=dark] { + --fg: #fff; + --bg: #333; + --bg-alt: #555; + --shadow: 0 1px 1px rgba(0, 0, 0, 0.8); +} +:root[data-color=dodgerblue] { + --primary: dodgerblue; +} +:root[data-color=darkorange] { + --primary: darkorange; +} +:root[data-color=limegreen] { + --primary: limegreen; +} diff --git a/app/css/app.less b/app/css/app.less index 478cc79..36ec2e6 100644 --- a/app/css/app.less +++ b/app/css/app.less @@ -44,6 +44,13 @@ button { flex-shrink: 0; } +select { + background-color: transparent; + border: 1px solid var(--fg); + border-radius: 4px; + padding: 2px 4px; +} + @import "font.less"; @import "icons.less"; @import "mixins.less"; @@ -56,6 +63,7 @@ button { @import "fs.less"; @import "playlists.less"; @import "yt.less"; +@import "settings.less"; @import "search.less"; @import "art.less"; @import "variables.less"; diff --git a/app/css/component.less b/app/css/component.less index 6fae25d..62de074 100644 --- a/app/css/component.less +++ b/app/css/component.less @@ -55,6 +55,6 @@ } li:nth-child(odd) { - background-color: #555; + background-color: var(--bg-alt); } } diff --git a/app/css/settings.less b/app/css/settings.less new file mode 100644 index 0000000..5ae0468 --- /dev/null +++ b/app/css/settings.less @@ -0,0 +1,23 @@ +#settings { + dl { + margin: 8px; + display: grid; + grid-template-columns: max-content 1fr; + align-items: center; + grid-gap: 8px; + } + + dt { + font-weight: bold; + } + + dd { + margin: 0; + .flex-column; + align-items: start; + } + + label { + .flex-row; + } +} \ No newline at end of file diff --git a/app/css/variables.less b/app/css/variables.less index 3cf5abd..4a89a02 100644 --- a/app/css/variables.less +++ b/app/css/variables.less @@ -1,9 +1,30 @@ :root { - --primary: dodgerblue; - --fg: #fff; - --bg: #333; - --shadow: 0 1px 1px rgba(0, 0, 0, 0.8); - --font-size-large: 112.5%; --icon-spacing: 4px; } + +:root[data-theme=light] { + --fg: #000; + --bg: #fff; + --bg-alt: #eee; + --shadow: none; +} + +:root[data-theme=dark] { + --fg: #fff; + --bg: #333; + --bg-alt: #555; + --shadow: 0 1px 1px rgba(0, 0, 0, 0.8); +} + +:root[data-color=dodgerblue] { + --primary: dodgerblue; +} + +:root[data-color=darkorange] { + --primary: darkorange; +} + +:root[data-color=limegreen] { + --primary: limegreen; +} diff --git a/app/index.html b/app/index.html index 1e2c3b5..54b57da 100644 --- a/app/index.html +++ b/app/index.html @@ -52,6 +52,32 @@

+
+
+
Theme
+
+ +
+
Color
+
+ + + +
+
+