diff --git a/.gitignore b/.gitignore index a2e78499..7bbcb06e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ dist *.vim* *.custom www/public +.vscode +.DS_Store diff --git a/code/layout-analyzer.js b/code/layout-analyzer.js index 3782a687..f9dce775 100644 --- a/code/layout-analyzer.js +++ b/code/layout-analyzer.js @@ -507,7 +507,7 @@ window.addEventListener('DOMContentLoaded', () => { const lvl = (contrast * count) / total; colormap[key] = impreciseData ? headingColor + `, ${lvl})` // gray scale - : `rgb(127, 127, 255, ${lvl})`; // blue scale + : `rgb(153, 19, 10, ${lvl})`; // scale with shades of --color-palette-e-dark = #99130A }); keyboard.setCustomColors(colormap); diff --git a/code/x-keyboard.js b/code/x-keyboard.js index ee1e009c..5b3b9ea2 100644 --- a/code/x-keyboard.js +++ b/code/x-keyboard.js @@ -207,9 +207,9 @@ function newKeyboardLayout(keyMap = {}, deadKeys = {}, geometry = '') { const KEY_BG = '#f8f8f8'; const SPECIAL_KEY_BG = '#e4e4e4'; const KEY_COLOR = '#333'; -const KEY_COLOR_L3 = 'blue'; -const KEY_COLOR_L5 = 'green'; -const DEAD_KEY_COLOR = 'red'; +const KEY_COLOR_L3 = '#0E9595'; // --color-palette-a-dark +const KEY_COLOR_L5 = '#CB8215'; // --color-palette-b-dark +const DEAD_KEY_COLOR = '#77372C'; // --color-palette-d-dark const KEY_WIDTH = 60; // 1U = 0.75" = 19.05mm = 60px const KEY_PADDING = 4; // 8px between two key edges @@ -912,26 +912,50 @@ const modifiers = ` // color themes const themes = ` + /* Base color palette -- https://coolors.co/9cf6f6-f3c98b-daa588-c46d5e-f56960 */ + :root { + --color-palette-a: #9CF6F6; + --color-palette-b: #F3C98B; + --color-palette-c: #DAA588; + --color-palette-d: #C46D5E; + --color-palette-e: #F56960; + } + + /* Derived color palette -- when lighter or darker shades are required */ + :root { + --color-palette-a-light: #DAFCFC; + --color-palette-b-light: #FBEEDA; + --color-palette-c-light: #F5E7E0; + --color-palette-d-light: #EED7D2; + --color-palette-e-light: #FBC9C5; + + --color-palette-a-dark: #0E9595; + --color-palette-b-dark: #CB8215; + --color-palette-c-dark: #9C5630; + --color-palette-d-dark: #77372C; + --color-palette-e-dark: #99130A; + } + g:target rect, .press rect, g:target path, .press path { - fill: #aad; + fill: var(--color-palette-c); } [theme="reach"] .pinkyKey rect { fill: hsl( 0, 100%, 90%); } - [theme="reach"] .numberKey rect { fill: hsl( 42, 100%, 90%); } - [theme="reach"] .letterKey rect { fill: hsl(122, 100%, 90%); } - [theme="reach"] .homeKey rect { fill: hsl(122, 100%, 75%); } - [theme="reach"] .press rect { fill: #aaf; } - - [theme="hints"] [finger="m1"] rect { fill: hsl( 0, 100%, 95%); } - [theme="hints"] [finger="l2"] rect { fill: hsl( 42, 100%, 85%); } - [theme="hints"] [finger="r2"] rect { fill: hsl( 61, 100%, 85%); } + [theme="reach"] .numberKey rect { fill: var(--color-palette-a-light); } + [theme="reach"] .letterKey rect { fill: var(--color-palette-b-light); } + [theme="reach"] .homeKey rect { fill: var(--color-palette-d-light); } + [theme="reach"] .press rect { fill: var(--color-palette-c-light); } + + [theme="hints"] [finger="m1"] rect { fill: var(--color-palette-a); } + [theme="hints"] [finger="l2"] rect { fill: var(--color-palette-a); } + [theme="hints"] [finger="r2"] rect { var(--color-palette-b); } [theme="hints"] [finger="l3"] rect, - [theme="hints"] [finger="r3"] rect { fill: hsl(136, 100%, 85%); } + [theme="hints"] [finger="r3"] rect { fill: var(--color-palette-c); } [theme="hints"] [finger="l4"] rect, - [theme="hints"] [finger="r4"] rect { fill: hsl(200, 100%, 85%); } + [theme="hints"] [finger="r4"] rect { fill: var(--color-palette-d); } [theme="hints"] [finger="l5"] rect, - [theme="hints"] [finger="r5"] rect { fill: hsl(230, 100%, 85%); } + [theme="hints"] [finger="r5"] rect { fill: var(--color-palette-e); } [theme="hints"] .specialKey rect, [theme="hints"] .specialKey path { fill: ${SPECIAL_KEY_BG}; } [theme="hints"] .hint rect { fill: #a33; } diff --git a/www/assets/css/icons.css b/www/assets/css/icons.css new file mode 100644 index 00000000..75ff4b15 --- /dev/null +++ b/www/assets/css/icons.css @@ -0,0 +1,131 @@ +/* Pure CSS-shapes icons taken from https://css.gg/icons */ + +.gg-software-download { + box-sizing: border-box; + position: relative; + display: inline-block; + transform: scale(var(--ggs, 1)); + width: 16px; + height: 6px; + border: 2px solid; + border-top: 0; + border-bottom-left-radius: 2px; + border-bottom-right-radius: 2px; + margin-top: 8px; +} +.gg-software-download::after { + content: ""; + display: inline-block; + box-sizing: border-box; + position: absolute; + width: 8px; + height: 8px; + border-left: 2px solid; + border-bottom: 2px solid; + transform: rotate(-45deg); + left: 2px; + bottom: 4px; +} +.gg-software-download::before { + content: ""; + display: inline-block; + box-sizing: border-box; + position: absolute; + border-radius: 3px; + width: 2px; + height: 10px; + background: currentColor; + left: 5px; + bottom: 5px; +} + +.gg-play-button-o { + box-sizing: border-box; + position: relative; + display: inline-block; + transform: scale(var(--ggs, 1)); + width: 22px; + height: 22px; + border: 2px solid; + border-radius: 20px; +} +.gg-play-button-o::before { + content: ""; + display: inline-block; + box-sizing: border-box; + position: absolute; + width: 0; + height: 10px; + border-top: 5px solid transparent; + border-bottom: 5px solid transparent; + border-left: 6px solid; + top: 4px; + left: 7px; +} + +.gg-align-bottom { + box-sizing: border-box; + position: relative; + display: inline-block; + height: 12px; + width: 12px; + border-bottom: 2px solid; + transform: scale(var(--ggs, 1)); + margin-top: 4px; +} +.gg-align-bottom::after, +.gg-align-bottom::before { + content: ""; + display: inline-block; + box-sizing: border-box; + position: absolute; + width: 4px; + background: currentColor; + bottom: 2px; +} +.gg-align-bottom::before { + left: 1px; + height: 12px; +} +.gg-align-bottom::after { + height: 6px; + right: 1px; + opacity: 0.5; +} + +.gg-keyboard { + box-sizing: border-box; + position: relative; + display: inline-block; + transform: scale(var(--ggs, 1)); + width: 18px; + height: 18px; + border: 2px solid; + border-radius: 3px; +} +.gg-keyboard::after, +.gg-keyboard::before { + content: ""; + display: inline-block; + box-sizing: border-box; + position: absolute; + height: 2px; + border-radius: 4px; + background: currentColor; +} +.gg-keyboard::before { + top: 2px; + box-shadow: + 4px 0 0, + 8px 0 0, + 0 4px 0, + 4px 4px 0, + 8px 4px 0; + width: 2px; + left: 2px; +} +.gg-keyboard::after { + width: 8px; + bottom: 2px; + left: 3px; +} \ No newline at end of file diff --git a/www/assets/css/keebs.css b/www/assets/css/keebs.css index dffba461..c774a6aa 100644 --- a/www/assets/css/keebs.css +++ b/www/assets/css/keebs.css @@ -4,18 +4,42 @@ * ╰───────────────────────────────────────────────────────────────╯ **/ +/* Base color palette -- https://coolors.co/9cf6f6-f3c98b-daa588-c46d5e-f56960 */ +:root { + --color-palette-a: #9CF6F6; + --color-palette-b: #F3C98B; + --color-palette-c: #DAA588; + --color-palette-d: #C46D5E; + --color-palette-e: #F56960; +} + +/* Derived color palette -- when lighter or darker shades are required */ +:root { + --color-palette-a-light: #DAFCFC; + --color-palette-b-light: #FBEEDA; + --color-palette-c-light: #F5E7E0; + --color-palette-d-light: #EED7D2; + --color-palette-e-light: #FBC9C5; + + --color-palette-a-dark: #0E9595; + --color-palette-b-dark: #CB8215; + --color-palette-c-dark: #9C5630; + --color-palette-d-dark: #77372C; + --color-palette-e-dark: #99130A; +} + :root { --fg-normal-shadow: #8bb8; --fg-normal-border: #666; - --fg-normal: #333; + --fg-normal: #aaa; --bg-normal: #fff; /* special keys */ --fg-special: #555; --bg-special: #e4e4e4; /* 'reach' theme */ - --bg-number: hsl(295, 100%, 95%); - --bg-letter: hsl(222, 100%, 95%); - --bg-home: hsl(222, 100%, 90%); + --bg-number: var(--color-palette-a-light); + --bg-letter: var(--color-palette-b-light); + --bg-home: var(--color-palette-d-light); } @media (prefers-color-scheme: dark) { :root { @@ -27,9 +51,9 @@ --fg-special: #888; --bg-special: #333; /* 'reach' theme */ - --bg-number: hsl(280, 10%, 34%); - --bg-letter: hsl(220, 15%, 35%); - --bg-home: hsl(225, 30%, 30%); + --bg-number: var(--color-palette-a-dark); + --bg-letter: var(--color-palette-b-dark); + --bg-home: var(--color-palette-d-dark); }} @@ -56,6 +80,118 @@ margin: 0; text-wrap: balance; text-align: center; + display: flex; + position: relative; +} + +.keyboard form fieldset input { + border-radius: 0px; + border-top: 1px solid #6668; + border-bottom: 1px solid #6668; + box-sizing: border-box; + border: none; + z-index: 1; + color: var(--fg-normal); +} + +.keyboard form fieldset::before{ + content: ''; + position: absolute; + left:0; + height: 100%; + border: 0.5px solid var(--fg-normal); + border-radius: 0.2em; + transition: .5s left ease; +} + +.keyboard form fieldset:has(:nth-child(1)) input, +.keyboard form fieldset:has(:nth-child(1))::before { + width: 100%; +} +.keyboard form fieldset:has(:nth-child(2)) input, +.keyboard form fieldset:has(:nth-child(2))::before { + width: 50%; +} +.keyboard form fieldset:has(:nth-child(3)) input, +.keyboard form fieldset:has(:nth-child(3))::before { + width: 33%; +} +.keyboard form fieldset:has(:nth-child(4)) input, +.keyboard form fieldset:has(:nth-child(4))::before { + width: 25%; +} +.keyboard form fieldset:has(:nth-child(5)) input, +.keyboard form fieldset:has(:nth-child(5))::before { + width: 20%; +} +.keyboard form fieldset:has(:nth-child(6)) input, +.keyboard form fieldset:has(:nth-child(6))::before { + width: 16.67%; +} + +.keyboard form fieldset:has(:nth-child(2)):has(:nth-child(1):checked)::before { + left: 0%; +} +.keyboard form fieldset:has(:nth-child(2)):has(:nth-child(2):checked)::before { + left: 50%; +} + +.keyboard form fieldset:has(:nth-child(3)):has(:nth-child(1):checked)::before { + left: 0%; +} +.keyboard form fieldset:has(:nth-child(3)):has(:nth-child(2):checked)::before { + left: 33%; +} +.keyboard form fieldset:has(:nth-child(3)):has(:nth-child(3):checked)::before { + left: 66%; +} + +.keyboard form fieldset:has(:nth-child(4)):has(:nth-child(1):checked)::before { + left: 0%; +} +.keyboard form fieldset:has(:nth-child(4)):has(:nth-child(2):checked)::before { + left: 25%; +} +.keyboard form fieldset:has(:nth-child(4)):has(:nth-child(3):checked)::before { + left: 50%; +} +.keyboard form fieldset:has(:nth-child(4)):has(:nth-child(4):checked)::before { + left: 75%; +} + +.keyboard form fieldset:has(:nth-child(5)):has(:nth-child(1):checked)::before { + left: 0%; +} +.keyboard form fieldset:has(:nth-child(5)):has(:nth-child(2):checked)::before { + left: 20%; +} +.keyboard form fieldset:has(:nth-child(5)):has(:nth-child(3):checked)::before { + left: 40%; +} +.keyboard form fieldset:has(:nth-child(5)):has(:nth-child(4):checked)::before { + left: 60%; +} +.keyboard form fieldset:has(:nth-child(5)):has(:nth-child(5):checked)::before { + left: 80%; +} + +.keyboard form fieldset:has(:nth-child(6)):has(:nth-child(1):checked)::before { + left: 0%; +} +.keyboard form fieldset:has(:nth-child(6)):has(:nth-child(2):checked)::before { + left: 16.6%; +} +.keyboard form fieldset:has(:nth-child(6)):has(:nth-child(3):checked)::before { + left: 33.3%; +} +.keyboard form fieldset:has(:nth-child(6)):has(:nth-child(4):checked)::before { + left: 50%; +} +.keyboard form fieldset:has(:nth-child(6)):has(:nth-child(5):checked)::before { + left: 66.6%; +} +.keyboard form fieldset:has(:nth-child(6)):has(:nth-child(6):checked)::before { + left: 83.3%; } .keyboard form input { @@ -68,25 +204,22 @@ outline: none; padding: 0 8px; margin: 2px 0; - background-color: var(--bg-special); + /* background-color: var(--bg-special); */ color: var(--fg-special); - border: 1px solid #6668; - border-radius: 2px; - opacity: 0.6; transition: all 50ms linear; cursor: pointer; } .keyboard form input:hover { - background-color: var(--bg-accent); + /* background-color: var(--bg-accent); */ + /* color: var(--bg-accent); */ opacity: 1; } .keyboard form input:checked { - background-image: linear-gradient(180deg, var(--bg-letter), var(--bg-home)); - background-color: var(--bg-normal); - text-shadow: 0 1px 0px var(--fg-normal-shadow); - color: var(--fg-normal); + /* background-image: linear-gradient(180deg, var(--bg-letter), var(--bg-home)); + background-color: var(--bg-normal); */ + font-weight: bold; opacity: 1; } @@ -111,7 +244,7 @@ display: none; text-align: center; text-wrap: balance; - margin: 1em auto; + margin: -0.5em auto 1.5em; } .keyboard nav a, @@ -121,13 +254,15 @@ margin: 2px 1px; padding: 0 6px; font-family: sans-serif; - font-size: 1em; + text-decoration: none; + font-size: 0.85em; + color: var(--fg-disabled); + background-color: transparent; } .keyboard nav button { font-weight: bold; cursor: pointer; - color: var(--fg-main); } .keyboard [disabled] { @@ -144,16 +279,16 @@ .keyboard nav a, .keyboard nav button { display: inline-block; - height: 2em; - line-height: 2em; - background-color: var(--bg-special); - border: 1px outset #6668; + height: 2.2em; + line-height: 3em; + border: 1px solid var(--fg-disabled); border-radius: 5px; } .keyboard nav a:hover, .keyboard nav button:hover { - background-color: var(--bg-accent); - text-decoration: underline; + text-decoration: none; + color: var(--fg-main); + border-color: var(--fg-main); } } diff --git a/www/assets/css/theme.css b/www/assets/css/theme.css index b1f81d07..535421c9 100644 --- a/www/assets/css/theme.css +++ b/www/assets/css/theme.css @@ -4,51 +4,112 @@ * ╰───────────────────────────────────────────────────────────────╯ **/ +/* Base color palette -- https://coolors.co/9cf6f6-f3c98b-daa588-c46d5e-f56960 */ +:root { + --color-palette-a: #9CF6F6; + --color-palette-b: #F3C98B; + --color-palette-c: #DAA588; + --color-palette-d: #C46D5E; + --color-palette-e: #F56960; +} + +/* Derived color palette -- when lighter or darker shades are required */ +:root { + --color-palette-a-light: #DAFCFC; + --color-palette-b-light: #FBEEDA; + --color-palette-c-light: #F5E7E0; + --color-palette-d-light: #EED7D2; + --color-palette-e-light: #FBC9C5; + + --color-palette-a-dark: #0E9595; + --color-palette-b-dark: #CB8215; + --color-palette-c-dark: #9C5630; + --color-palette-d-dark: #77372C; + --color-palette-e-dark: #99130A; +} + +/* Keycap color palette -- for generating realistic keycaps */ +:root { + --keycap-color-a: #282828; + --keycap-color-b: #202020; + --keycap-color-c: #232323; + --keycap-color-d: #4a4a4a; + --keycap-color-e: #0009; + --keycap-color-f: #0004; + --keycap-color-i: rgba(255, 255, 255, 1.0); + --keycap-bs-1: rgba(0, 0, 0, 0.15); + --keycap-bs-2: rgba(0, 0, 0, 0.25); + --keycap-bs-3: rgba(0, 0, 0, 0.75); + --keycap-bs-4: rgba(0, 0, 0, 0.25); +} + + :root { color-scheme: light dark; /* background and text colors */ - --bg-root: #ccc; - --bg-main: #f8f8f8; - --bg-main-shadow: #888; - --fg-main-border: #aaa; + --bg-root: white; + --bg-main: white; + --bg-main-shadow: white; + --fg-main-border: white; --fg-main: #222; + --fg-disabled: #999; /* banner -- the foreground matches the favicon #rocket color */ - --bg-banner: #e9e9e9; - --fg-banner-border: #5446; - --fg-banner: #544; + --bg-banner: white; + --fg-banner-border: #eee; + --fg-banner: #222; /*