From 773d67e75a3d01df5ad492896e19f5029e6e35d2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Tue, 29 Dec 2020 21:33:57 -0500 Subject: Split material css (#1175) * Separate material styles into a separate file * Improve action button styles * Rename --font-size-default to --font-size * Remove px units * Remove some material vars * Fix some variable names * Define variables * Remove --shadow-vertical * Revert name change * Move var * Rename var * Update vars * Remove redundant vars * Update search styles * Update styles * Update colors * Update variable names * Include material.css on float.html page --- ext/bg/css/settings2.css | 783 +---------------------------------------- ext/bg/info.html | 1 + ext/bg/legal.html | 1 + ext/bg/permissions.html | 1 + ext/bg/search.html | 1 + ext/bg/settings2.html | 1 + ext/bg/welcome.html | 7 +- ext/fg/float.html | 1 + ext/mixed/css/display.css | 89 ++--- ext/mixed/css/material.css | 845 +++++++++++++++++++++++++++++++++++++++++++++ ext/mixed/css/search.css | 209 +---------- 11 files changed, 933 insertions(+), 1006 deletions(-) create mode 100644 ext/mixed/css/material.css (limited to 'ext') diff --git a/ext/bg/css/settings2.css b/ext/bg/css/settings2.css index 89359309..303b71c4 100644 --- a/ext/bg/css/settings2.css +++ b/ext/bg/css/settings2.css @@ -23,17 +23,11 @@ --main-content-padding: 10px; --sidebar-size: 200px; --preview-sidebar-expanded-width: 400px; - --shadow-color: rgba(0, 0, 0, 0.185); - --shadow-color-off: rgba(0, 0, 0, 0); - --shadow-color-light: rgba(0, 0, 0, 0.085); --shadow-vertical: 0 1px 4px 0 var(--shadow-color), 0 2px 2px 0 var(--shadow-color); --shadow-vertical-strong: 0 1px 3px 1px var(--shadow-color), 0 2px 4px 3px var(--shadow-color); --shadow-vertical-top: 0 -1px 4px 0 var(--shadow-color), 0 -2px 2px 0 var(--shadow-color); --shadow-left: -1px 0 4px 0 var(--shadow-color), -2px 0 2px 0 var(--shadow-color); --shadow-right: 1px 0 4px 0 var(--shadow-color), 2px 0 2px 0 var(--shadow-color); - --animation-duration: 0s; - --animation-duration2: calc(var(--animation-duration) * 2); - --animation-duration-half: calc(var(--animation-duration) / 2); --settings-group-horizontal-margin: 0; --settings-group-inner-vertical-margin: 0.75em; --settings-group-inner-vertical-padding: 0.85em; @@ -46,28 +40,17 @@ --settings-group-wrap: nowrap; --show-preview-label-height: 40px; - --font-size-default-no-units: 14; - --font-size-default: calc(1px * var(--font-size-default-no-units)); + --font-size-no-units: 14; + --font-size: calc(1px * var(--font-size-no-units)); --font-size-small: 12px; - --line-height-default: calc(20 / var(--font-size-default-no-units)); + --line-height-default: calc(20 / var(--font-size-no-units)); --outline-item-height: 40px; --outline-item-icon-size: 32px; - --input-width: 100px; - --input-width-large: 200px; --input-short: 80px; - --input-height: 32px; --input-height-short: 24px; --input-half-width: calc(var(--input-width-large) / 2 - var(--padding) / 2); - --thin-border-size: 1px; - --icon-button-size: 36px; --fab-button-size: 56px; --fab-button-padding: 16px; - --checkbox-size: 16px; - --toggle-size: 16px; - --radio-size: 20px; - --button-shadow-params: 0 1px 2px 0; - --material-arrow-dimension1: 5px; - --material-arrow-dimension2: 10px; --modal-width: 600px; --modal-height: 400px; --modal-width-small: 400px; @@ -78,13 +61,6 @@ --menu-item-hover-color: #bbbbbb; --menu-item-active-color: #aaaaaa; - --text-color-default: #222222; - --background-color: #f8f9fa; - --background-color-light: #ffffff; - --input-background-color: #f2f2f2; - --input-background-color-dark: #dddddd; - --input-background-color-darker: #cccccc; - --input-outline-color: var(--text-color-default); --link-color: var(--accent-color); --link-color-hover: var(--accent-color-dark); --text-color-light: #666666; @@ -93,52 +69,24 @@ --separator-color2: #eeeeee; --outline-item-background-color: rgba(13, 13, 13, 0.0); --outline-item-background-color-hover: rgba(13, 13, 13, 0.15); - --button-text-color: #ffffff; - --button-border-color: var(--separator-color1); - --accent-color: #1a73e8; - --accent-color-light: #4a91ed; - --accent-color-lighter: #8db9f4; - --accent-color-lightest: #a7c9f6; - --accent-color-dark: #1060c0; - --accent-color-transparent0: rgba(28, 116, 233, 0); - --accent-color-transparent5: rgba(28, 116, 233, 0.05); - --accent-color-transparent25: rgba(28, 116, 233, 0.25); - --danger-color: #c83c28; - --danger-color-light: #dd6755; - --danger-color-lighter: #e68d7f; - --danger-color-lightest: #eeb3aa; - --danger-color-transparent0: rgba(200, 60, 40, 0); - --danger-color-transparent5: rgba(200, 60, 40, 0.05); - --danger-color-transparent25: rgba(200, 60, 40, 0.25); --warning-color: #96751c; --warning-color-light: hsl(44, 80%, 65%); - --disabled-color: #aaaaaa; - --disabled-color-light: #dddddd; - --disabled-color-lighter: #eeeeee; --dim-background-color: rgba(0, 0, 0, 0.5); - --checkbox-checked: var(--accent-color); - --checkbox-unchecked: #666666; - --checkbox-check-color: var(--background-color-light); - --checkbox-disabled: #aaaaaa; - --toggle-track-color: #cccccc; - --toggle-knob-color: var(--background-color-light); - --selectable-indicator-color: rgba(160, 160, 160, 0.25); --content-dimmer-color: rgba(0, 0, 0, 0.1); - --button-icon-color: #333333; - --button-icon-color-light: #666666; --modal-padding-horizontal: 1em; --modal-padding-vertical: 0.625em; --modal-padding-vertical-half: calc(var(--modal-padding-vertical) * 0.5); --modal-button-spacing: 0.625em; - - --text-input-border-radius: 0.25em; - --textarea-line-height: 1.25em; - --textarea-padding: 0.5em; } -:root[data-loaded=true] { - --animation-duration: 0.125s; +:root:not([data-loaded=true]) { + --animation-duration: 0s; } +:root[data-theme=dark] { + --separator-color1: #333333; + --separator-color2: #222222; +} + @media (max-width: 700px) { :root { @@ -167,9 +115,9 @@ body { margin: 0; padding: 0; border: none; - font-size: var(--font-size-default); + font-size: var(--font-size); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - color: var(--text-color-default); + color: var(--text-color); line-height: var(--line-height-default); height: 100%; overflow: hidden; @@ -278,48 +226,6 @@ h3 { } -/* Icons */ -.icon { - --icon-image: none; - --icon-size: contain; - -webkit-mask-repeat: no-repeat; - -webkit-mask-position: center center; - -webkit-mask-mode: alpha; - -webkit-mask-size: var(--icon-size); - -webkit-mask-image: var(--icon-image); - mask-repeat: no-repeat; - mask-position: center center; - mask-mode: alpha; - mask-size: var(--icon-size); - mask-image: var(--icon-image); -} -.icon[data-icon=profile] { --icon-image: url(/mixed/img/profile.svg); } -.icon[data-icon=cog] { --icon-image: url(/mixed/img/cog.svg); } -.icon[data-icon=palette] { --icon-image: url(/mixed/img/palette.svg); } -.icon[data-icon=popup] { --icon-image: url(/mixed/img/popup.svg); } -.icon[data-icon=speaker] { --icon-image: url(/mixed/img/speaker.svg); } -.icon[data-icon=scanning] { --icon-image: url(/mixed/img/scanning.svg); } -.icon[data-icon=text-parsing] { --icon-image: url(/mixed/img/text-parsing.svg); } -.icon[data-icon=translation] { --icon-image: url(/mixed/img/translation.svg); } -.icon[data-icon=book] { --icon-image: url(/mixed/img/book.svg); } -.icon[data-icon=note-card] { --icon-image: url(/mixed/img/note-card.svg); } -.icon[data-icon=keyboard] { --icon-image: url(/mixed/img/keyboard.svg); } -.icon[data-icon=backup] { --icon-image: url(/mixed/img/backup.svg); } -.icon[data-icon=lock] { --icon-image: url(/mixed/img/lock.svg); } -.icon[data-icon=question-mark] { --icon-image: url(/mixed/img/question-mark.svg); } -.icon[data-icon=popup-size] { --icon-image: url(/mixed/img/popup-size.svg); } -.icon[data-icon=hamburger-menu] { --icon-image: url(/mixed/img/hamburger-menu.svg); } -.icon[data-icon=kebab-menu] { --icon-image: url(/mixed/img/kebab-menu.svg); } -.icon[data-icon=mouse] { --icon-image: url(/mixed/img/mouse.svg); } -.icon[data-icon=material-down-arrow] { --icon-image: url(/mixed/img/material-down-arrow.svg); } -.icon[data-icon=material-right-arrow] { --icon-image: url(/mixed/img/material-right-arrow.svg); } -.icon[data-icon=exclamation-point-short] { --icon-image: url(/mixed/img/exclamation-point-short.svg); } -.icon[data-icon=magnifying-glass] { --icon-image: url(/mixed/img/magnifying-glass.svg); } -.icon[data-icon=collapse] { --icon-image: url(/mixed/img/collapse.svg); } -.icon[data-icon=expand] { --icon-image: url(/mixed/img/expand.svg); } -.icon[data-icon=window] { --icon-image: url(/mixed/img/window.svg); } - - /* Content layout */ .content-outer { display: flex; @@ -456,7 +362,7 @@ h3 { visibility: hidden; } .sidebar-top-link:not(:hover) { - color: var(--text-color-default); + color: var(--text-color); } .sidebar-top-icon { display: inline-block; @@ -487,7 +393,7 @@ h3 { .outline-item, .outline-item:hover { text-decoration: none; - color: var(--text-color-default); + color: var(--text-color); } .outline-item:hover { background-color: var(--outline-item-background-color-hover); @@ -699,7 +605,7 @@ h3 { .settings-item.settings-item-button, a.settings-item.settings-item-button { cursor: pointer; - color: var(--text-color-default); + color: var(--text-color); text-decoration: none; background-color: transparent; transition: background-color var(--animation-duration) ease-in-out; @@ -779,659 +685,6 @@ select.short-height { } -/* Material design checkbox */ -label.checkbox { - cursor: default; -} -.checkbox { - font-size: var(--checkbox-size); - display: inline-block; -} -.checkbox>input[type=checkbox] { - opacity: 0; - width: 0; - height: 0; - display: block; - margin: 0; - padding: 0; - border: none; - appearance: none; - -moz-appearance: none; - -webkit-appearance: none; -} -.checkbox-body { - display: block; - cursor: pointer; - width: 1em; - height: 1em; - position: relative; - cursor: pointer; -} -.checkbox>input[type=checkbox]:disabled+.checkbox-body { - cursor: default; -} -.checkbox-fill, -.checkbox-border, -.checkbox-check { - display: block; - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - mask-repeat: no-repeat; - mask-position: center center; - mask-mode: alpha; - mask-size: contain; - -webkit-mask-repeat: no-repeat; - -webkit-mask-position: center center; - -webkit-mask-mode: alpha; - -webkit-mask-size: contain; - transition: opacity var(--animation-duration) linear, background-color var(--animation-duration) linear; -} -.checkbox-fill { - mask-image: url(/mixed/img/checkbox-fill.svg); - -webkit-mask-image: url(/mixed/img/checkbox-fill.svg); - background-color: var(--checkbox-unchecked); - opacity: 0; -} -.checkbox-border { - mask-image: url(/mixed/img/checkbox-border.svg); - -webkit-mask-image: url(/mixed/img/checkbox-border.svg); - background-color: var(--checkbox-unchecked); - opacity: 1; -} -.checkbox-check { - mask-image: url(/mixed/img/checkbox-check.svg); - -webkit-mask-image: url(/mixed/img/checkbox-check.svg); - background-color: var(--checkbox-check-color); - opacity: 0; -} -.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-fill { - background-color: var(--checkbox-checked); - opacity: 1; -} -.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-border { - background-color: var(--checkbox-checked); - opacity: 1; -} -.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-check { - background-color: var(--checkbox-check-color); - opacity: 1; -} -.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-fill { - opacity: 0; -} -.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-border { - background-color: var(--checkbox-disabled); - opacity: 1; -} -.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-check { - background-color: var(--checkbox-disabled); -} - - -/* Material design toggle switch */ -label.toggle { - cursor: default; -} -.toggle { - font-size: var(--toggle-size); - display: inline-block; -} -.toggle>input[type=checkbox] { - opacity: 0; - width: 0; - height: 0; - display: block; - margin: 0; - padding: 0; - border: none; - appearance: none; - -moz-appearance: none; - -webkit-appearance: none; -} -.toggle-body { - display: block; - cursor: pointer; - width: 2em; - height: 1em; - position: relative; -} -.toggle-track { - display: block; - position: absolute; - left: 0.125em; - right: 0.125em; - top: 0.125em; - bottom: 0.125em; - background-color: var(--toggle-track-color); - border-radius: 0.4375em; - transition: background-color var(--animation-duration) ease-in-out; -} -.toggle-knob { - display: block; - position: absolute; - left: 0; - top: 0; - width: 1em; - height: 1em; - background-color: var(--toggle-knob-color); - border-radius: 0.5em; - box-shadow: var(--shadow-vertical); - transition: transform var(--animation-duration) ease-in-out, - background-color var(--animation-duration) ease-in-out; -} -.toggle-body>.toggle-knob::after { - position: absolute; - display: block; - content: ""; - left: -0.75em; - top: -0.75em; - right: -0.75em; - bottom: -0.75em; - border-radius: 2.5em; - background-color: var(--selectable-indicator-color); - pointer-events: none; - transform: scale(0); - opacity: 0; - visibility: hidden; - transition: transform 0s ease-in-out var(--animation-duration2), - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility 0s ease-in-out var(--animation-duration2); -} -.toggle>input[type=checkbox]:focus:not(:disabled)+.toggle-body>.toggle-knob::after, -.toggle:active>input[type=checkbox]:not(:disabled)+.toggle-body>.toggle-knob::after { - transform: scale(1); - opacity: 1; - visibility: visible; - transition: transform var(--animation-duration2) ease-in-out, - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility var(--animation-duration2) ease-in-out; -} -.toggle>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { - opacity: 0.5; -} -.toggle:active>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { - opacity: 1; -} -.toggle>input[type=checkbox]:checked+.toggle-body>.toggle-knob { - transform: translateX(1em); -} -.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-track { - background-color: var(--accent-color-lighter); -} -.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob { - background-color: var(--accent-color); -} -.toggle>input[type=checkbox]:focus:checked:not(:disabled)+.toggle-body>.toggle-knob::after, -.toggle:active>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob::after { - background-color: var(--accent-color-transparent25); -} -.toggle>input[type=checkbox]:disabled+.toggle-body { - cursor: default; -} -.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-track { - background-color: var(--disabled-color-light); -} -.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-knob { - background-color: var(--disabled-color-lighter); -} - - -/* Radio button */ -label.radio { - cursor: default; -} -.radio { - display: inline-block; - vertical-align: middle; -} -.radio>input[type=radio] { - opacity: 0; - width: 0; - height: 0; - display: block; - margin: 0; - padding: 0; - border: none; - cursor: default; - appearance: none; - -moz-appearance: none; - -webkit-appearance: none; -} -.radio>input[type=radio]:not(:disabled)+.radio-body { - cursor: pointer; -} -.radio-body { - display: block; - position: relative; - width: var(--radio-size); - height: var(--radio-size); -} -.radio-border, -.radio-dot { - display: block; - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - background-color: var(--accent-color); - mask-repeat: no-repeat; - mask-position: center center; - mask-mode: alpha; - mask-size: var(--radio-size) var(--radio-size); - -webkit-mask-repeat: no-repeat; - -webkit-mask-position: center center; - -webkit-mask-mode: alpha; - -webkit-mask-size: var(--radio-size) var(--radio-size); -} -.radio-border { - mask-image: url(/mixed/img/radio-button.svg); - -webkit-mask-image: url(/mixed/img/radio-button.svg); -} -.radio-dot { - mask-image: url(/mixed/img/radio-button-dot.svg); - -webkit-mask-image: url(/mixed/img/radio-button-dot.svg); - opacity: 1; - transform: none; - transition: transform var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility var(--animation-duration2) ease-in-out; -} -.radio>input[type=radio]:disabled+.radio-body>.radio-border, -.radio>input[type=radio]:disabled+.radio-body>.radio-dot { - background-color: var(--disabled-color); -} -.radio>input[type=radio]:not(:checked)+.radio-body>.radio-dot { - opacity: 0; - transform: scale(0); - transition: transform 0s ease-in-out var(--animation-duration2), - opacity var(--animation-duration2) ease-in-out, - visibility 0s ease-in-out var(--animation-duration2); -} -.radio-body::after { - position: absolute; - display: block; - content: ""; - left: -0.75em; - top: -0.75em; - right: -0.75em; - bottom: -0.75em; - border-radius: 2.5em; - background-color: var(--selectable-indicator-color); - pointer-events: none; - transform: scale(0); - opacity: 0; - visibility: hidden; - transition: transform 0s ease-in-out var(--animation-duration2), - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility 0s ease-in-out var(--animation-duration2); -} -.radio>input[type=radio]:focus:not(:disabled)+.radio-body::after, -.radio:active>input[type=radio]:not(:disabled)+.radio-body::after { - transform: scale(1); - opacity: 1; - visibility: visible; - transition: transform var(--animation-duration2) ease-in-out, - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility var(--animation-duration2) ease-in-out; -} -.radio>input[type=radio]:focus+.radio-body::after { - opacity: 0.5; -} -.radio:active>input[type=radio]:focus+.radio-body::after { - opacity: 1; -} -.radio-label { - cursor: pointer; - white-space: nowrap; -} -.radio-label>.radio { - vertical-align: middle; -} -.radio-label>.radio-label-text { - display: inline-block; - margin-left: 0.5em; - vertical-align: middle; - white-space: normal; -} - - -/* Material design select */ -select { - width: var(--input-width-large); - height: var(--input-height); - line-height: var(--input-height); - border: 0; - border-radius: 0.25em; - box-sizing: border-box; - padding: 0 0.5em; - appearance: none; - -moz-appearance: none; - -webkit-appearance: none; - background-image: url(/mixed/img/material-down-arrow.svg); - background-repeat: no-repeat; - background-position: right var(--padding) center; - background-color: var(--input-background-color); - background-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); - cursor: pointer; -} -select::-ms-expand { - display: none; -} - - -/* Material design inputs */ -input[type=text], -input[type=number] { - width: var(--input-width); - height: var(--input-height); - line-height: var(--input-height); - background-color: var(--input-background-color); - border: none; - border-radius: var(--text-input-border-radius); - box-sizing: border-box; - padding: 0 0.5em; - appearance: textfield; - -moz-appearance: textfield; - -webkit-appearance: textfield; -} -input[type=number]::-webkit-inner-spin-button, -input[type=number]::-webkit-outer-spin-button { - appearance: none; - -moz-appearance: none; - -webkit-appearance: none; - margin: 0; -} -input[type=text] { - width: var(--input-width-large); -} -textarea { - box-sizing: border-box; - padding: var(--textarea-padding); - font-family: 'Courier New', Courier, monospace; - background-color: var(--input-background-color); - border-radius: var(--text-input-border-radius); - line-height: var(--textarea-line-height); - border: 1px solid var(--input-background-color); -} -select:invalid, -textarea:invalid, -input[type=text]:invalid, -input[type=number]:invalid, -select[data-invalid=true], -textarea[data-invalid=true], -input[type=text][data-invalid=true], -input[type=number][data-invalid=true] { - border: var(--thin-border-size) solid var(--danger-color); -} -select, -textarea, -input[type=text], -input[type=number] { - box-shadow: none; - transition: box-shadow var(--animation-duration-half) linear; -} -select:focus, -textarea:focus, -input[type=text]:focus, -input[type=number]:focus { - box-shadow: 0 0 0 2px var(--input-outline-color); - outline: none; -} -select:invalid:focus, -textarea:invalid:focus, -input[type=text]:invalid:focus, -input[type=number]:invalid:focus, -select[data-invalid=true]:focus, -textarea[data-invalid=true]:focus, -input[type=text][data-invalid=true]:focus, -input[type=number][data-invalid=true]:focus { - box-shadow: 0 0 0 2px var(--danger-color); - outline: none; -} -input[type=text].input-with-suffix-button, -input[type=number].input-with-suffix-button { - flex: 1 1 auto; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - border-right-style: none; - z-index: 1; -} - - -/* Material design button */ -button { - border: var(--thin-border-size) solid transparent; - border-radius: 0.3em; - padding: 0.5em 1em; - font-weight: bold; - font-size: inherit; - font-family: inherit; - cursor: pointer; - background-color: transparent; - box-shadow: var(--button-shadow-params) var(--shadow-color-off); - transition: background-color var(--animation-duration) ease-in, box-shadow var(--animation-duration) ease-in, border-color var(--animation-duration) ease-in; - -webkit-tap-highlight-color: transparent; -} -button:focus { - outline: none; -} -button:hover { - transition: background-color var(--animation-duration) ease-out, box-shadow var(--animation-duration) ease-out, border-color var(--animation-duration) ease-out; -} -button:hover:not(:disabled) { - box-shadow: var(--button-shadow-params) var(--shadow-color-light); -} -button:active:not(:disabled) { - box-shadow: var(--button-shadow-params) var(--shadow-color); -} - -/* Standard button */ -button:not(:disabled) { - color: var(--button-text-color); - border-color: var(--accent-color); - background-color: var(--accent-color); -} -button:hover:not(:disabled) { - background-color: var(--accent-color-light); - border-color: var(--accent-color-light); -} -button:focus:not(:disabled) { - background-color: var(--accent-color-light); -} -button:active:not(:disabled) { - border-color: var(--accent-color-lighter); - background-color: var(--accent-color-lighter); -} - -/* Standard danger button */ -button.danger:not(:disabled) { - color: var(--button-text-color); - border-color: var(--danger-color); - background-color: var(--danger-color); -} -button.danger:hover:not(:disabled) { - background-color: var(--danger-color-light); - border-color: var(--danger-color-light); -} -button.danger:focus:not(:disabled) { - background-color: var(--danger-color-light); -} -button.danger:active:not(:disabled) { - border-color: var(--danger-color-lighter); - background-color: var(--danger-color-lighter); -} - -/* Low emphasis button */ -button.low-emphasis:not(:disabled) { - color: var(--accent-color); - border-color: var(--button-border-color); - background-color: var(--accent-color-transparent0); -} -button.low-emphasis:hover:not(:disabled) { - background-color: var(--accent-color-transparent5); - border-color: var(--accent-color-light); -} -button.low-emphasis:focus:not(:disabled) { - border-color: var(--accent-color); -} -button.low-emphasis:active:not(:disabled) { - border-color: var(--accent-color); - background-color: var(--accent-color-transparent25); -} - -/* Low emphasis danger button */ -button.low-emphasis.danger:not(:disabled) { - color: var(--danger-color); - border-color: var(--button-border-color); - background-color: var(--danger-color-transparent0); -} -button.low-emphasis.danger:hover:not(:disabled) { - border-color: var(--danger-color-light); - background-color: var(--danger-color-transparent5); -} -button.low-emphasis.danger:focus:not(:disabled) { - border-color: var(--danger-color); -} -button.low-emphasis.danger:active:not(:disabled) { - border-color: var(--danger-color); - background-color: var(--danger-color-transparent25); -} - -/* Disabled buttons */ -button:disabled { - color: var(--button-text-color); - border-color: var(--disabled-color); - background-color: var(--disabled-color); - cursor: default; -} -button.low-emphasis:disabled { - color: var(--disabled-color); - border-color: var(--disabled-color); - background-color: transparent; -} - -/* Input suffix button */ -button.input-suffix-button { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - border: none; - height: var(--input-height); - line-height: var(--input-height); - background-color: var(--input-background-color); - box-sizing: border-box; - padding: 0 0.5em; - border-color: transparent; -} -button.input-suffix-button.input-suffix-icon-button { - width: 2.125em; - position: relative; -} -button.input-suffix-button.input-suffix-icon-button:hover, -button.input-suffix-button.input-suffix-icon-button:focus { - background-color: var(--input-background-color-dark); -} -button.input-suffix-button.input-suffix-icon-button:active { - background-color: var(--input-background-color-darker); -} -input[type=text]:invalid+button.input-suffix-button, -input[type=number]:invalid+button.input-suffix-button, -input[type=text][data-invalid=true]+button.input-suffix-button, -input[type=number][data-invalid=true]+button.input-suffix-button { - border: var(--thin-border-size) solid var(--danger-color); - border-left-style: none; -} - - -/* Material design icon button */ -button.icon-button { - display: inline-block; - vertical-align: middle; - border: none; - margin: 0; - padding: 0; - box-sizing: content-box; - font-size: inherit; - cursor: pointer; - background-color: transparent; -} -button.icon-button>.icon-button-inner { - display: block; - width: var(--icon-button-size); - height: var(--icon-button-size); - position: relative; -} -button.icon-button:focus { - outline: none; -} -button.icon-button, -button.icon-button:hover, -button.icon-button:focus, -button.icon-button:active { - background-color: transparent; - box-shadow: none; -} -.icon-button>.icon-button-inner::after { - position: absolute; - display: block; - content: ""; - left: 0; - top: 0; - right: 0; - bottom: 0; - border-radius: 50%; - background-color: var(--selectable-indicator-color); - pointer-events: none; - transform: scale(0); - opacity: 0; - visibility: hidden; - transition: transform 0s ease-in-out var(--animation-duration2), - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility 0s ease-in-out var(--animation-duration2); -} -.icon-button:focus>.icon-button-inner::after { - transform: scale(1); - opacity: 1; - visibility: visible; - transition: transform var(--animation-duration2) ease-in-out, - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility var(--animation-duration2) ease-in-out; -} -.icon-button>.icon-button-inner>.icon { - display: block; - position: absolute; - left: 0; - top: 0; - right: 0; - bottom: 0; - background-color: var(--button-icon-color); - --icon-size: 16px 16px; -} -.icon-button>.icon-button-inner>.icon.icon-button-icon-light { - background-color: var(--button-icon-color-light); -} -.icon-button>.icon-button-inner>.icon[data-icon=material-right-arrow] { --icon-size: var(--material-arrow-dimension1) var(--material-arrow-dimension2); } -.icon-button>.icon-button-inner>.icon[data-icon=material-down-arrow] { --icon-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); } - -.input-height-icon-button-container { - height: var(--input-height); - box-sizing: border-box; -} -.input-height-icon-button-container>.icon-button { - position: relative; - top: calc((var(--input-height) - var(--icon-button-size)) * 0.5); -} - - /* Modal */ .modal-container { position: fixed; @@ -1696,7 +949,7 @@ button.popup-menu-item { padding: 0.625em 1.5em; border-radius: 0; background-color: transparent; - color: var(--text-color-default); + color: var(--text-color); border: none; width: 100%; text-align: left; @@ -2220,7 +1473,7 @@ select.profile-condition-operator { .anki-card-field-name-container[data-invalid=true], .anki-card-field-name-container[data-order-matches=false][data-index='0'] { background-color: var(--danger-color-lightest); - border-radius: var(--text-input-border-radius); + border-radius: var(--input-border-radius); } .anki-card-field-name { flex: 1 1 auto; @@ -2336,7 +1589,7 @@ code.anki-field-marker { font-family: 'Courier New', Courier, monospace; background-color: var(--input-background-color); border: none; - border-radius: var(--text-input-border-radius); + border-radius: var(--input-border-radius); line-height: var(--textarea-line-height); overflow: auto; white-space: pre; diff --git a/ext/bg/info.html b/ext/bg/info.html index cc69ed1c..07edcbcf 100644 --- a/ext/bg/info.html +++ b/ext/bg/info.html @@ -11,6 +11,7 @@ + diff --git a/ext/bg/legal.html b/ext/bg/legal.html index 7aca19bc..9e63c0f0 100644 --- a/ext/bg/legal.html +++ b/ext/bg/legal.html @@ -11,6 +11,7 @@ + diff --git a/ext/fg/float.html b/ext/fg/float.html index 2064e8ed..d3c9ba27 100644 --- a/ext/fg/float.html +++ b/ext/fg/float.html @@ -11,6 +11,7 @@ + diff --git a/ext/mixed/css/display.css b/ext/mixed/css/display.css index f0f39d07..abf8ae6e 100644 --- a/ext/mixed/css/display.css +++ b/ext/mixed/css/display.css @@ -81,17 +81,16 @@ /* Colors */ --background-color: #ffffff; --glossary-image-background-color: #eeeeee; - --accent-color: #0275d8; --link-color: var(--accent-color); - --default-text-color: #000000; - --light-text-color: #777777; - --very-light-text-color: #999999; - --kanji-text-color: var(--default-text-color); + --text-color: #000000; + --text-color-light: #777777; + --text-color-very-light: #999999; + --kanji-text-color: var(--text-color); --kanji-popular-text-color: var(--accent-color); - --kanji-rare-text-color: var(--very-light-text-color); + --kanji-rare-text-color: var(--text-color-very-light); --kanji-furigana-text-color: inherit; - --reason-text-color: var(--light-text-color); + --reason-text-color: var(--text-color-light); --light-border-color: #eeeeee; --medium-border-color: #dddddd; @@ -136,22 +135,23 @@ --notification-text-color: #ffffff; --notification-background-color: #333333; --notification-shadow-color: rgba(0, 0, 0, 0.5); + + --action-button-active-color: var(--scrollbar-thumb-color); } :root[data-theme=dark] { /* Colors */ --background-color: #1e1e1e; --glossary-image-background-color: #2f2f2f; - --accent-color: #4eacfd; --link-color: var(--accent-color); - --default-text-color: #d4d4d4; - --light-text-color: #888888; - --very-light-text-color: #666666; - --kanji-text-color: var(--default-text-color); + --text-color: #d4d4d4; + --text-color-light: #888888; + --text-color-very-light: #666666; + --kanji-text-color: var(--text-color); --kanji-popular-text-color: var(--accent-color); - --kanji-rare-text-color: var(--very-light-text-color); + --kanji-rare-text-color: var(--text-color-very-light); --kanji-furigana-text-color: inherit; - --reason-text-color: var(--light-text-color); + --reason-text-color: var(--text-color-light); --light-border-color: #2f2f2f; --medium-border-color: #3f3f3f; @@ -196,6 +196,8 @@ --notification-text-color: #2f2f2f; --notification-background-color: #e1e1e1; --notification-shadow-color: rgba(255, 255, 255, 0.25); + + --action-button-active-color: var(--scrollbar-thumb-color); } @@ -224,7 +226,7 @@ body { height: 100%; overflow: hidden; background-color: var(--background-color); - color: var(--default-text-color); + color: var(--text-color); font-size: inherit; } ol, ul { @@ -541,7 +543,8 @@ button.sidebar-button.danger:hover .sidebar-button-icon { content: ''; display: block; } -.action-button { +button.action-button { + cursor: pointer; display: block; opacity: 1; border: 0; @@ -553,12 +556,10 @@ button.sidebar-button.danger:hover .sidebar-button-icon { opacity var(--animation-duration) linear, visibility 0s linear 0s, filter var(--animation-duration) linear, - -webkit-filter var(--animation-duration) linear; + -webkit-filter var(--animation-duration) linear, + background-color var(--animation-duration) linear; } -button.action-button { - cursor: pointer; -} -.action-button[hidden] { +button.action-button[hidden] { display: block; visibility: hidden; opacity: 0; @@ -566,18 +567,26 @@ button.action-button { opacity var(--animation-duration) linear, visibility 0s linear var(--animation-duration), filter var(--animation-duration) linear, - -webkit-filter var(--animation-duration) linear; + -webkit-filter var(--animation-duration) linear, + background-color var(--animation-duration) linear; } -.action-button:disabled { +button.action-button:disabled { pointer-events: none; cursor: default; -webkit-filter: grayscale(100%); filter: grayscale(100%); + background-color: transparent; } -.action-button:disabled:not([hidden]) { +button.action-button:disabled:not([hidden]) { opacity: 0.25; } -.action-button::before { +button.action-button:hover { + background-color: transparent; +} +button.action-button:active { + background-color: var(--action-button-active-color); +} +button.action-button::before { content: ""; width: var(--action-button-size); height: var(--action-button-size); @@ -586,22 +595,22 @@ button.action-button { background-repeat: no-repeat; background-size: contain; } -.action-button[data-icon=view-note]::before { +button.action-button[data-icon=view-note]::before { background-image: url("/mixed/img/view-note.svg"); } -.action-button[data-icon=add-term-kanji]::before { +button.action-button[data-icon=add-term-kanji]::before { background-image: url("/mixed/img/add-term-kanji.svg"); } -.action-button[data-icon=add-term-kana]::before { +button.action-button[data-icon=add-term-kana]::before { background-image: url("/mixed/img/add-term-kana.svg"); } -.action-button[data-icon=play-audio]::before { +button.action-button[data-icon=play-audio]::before { background-image: url("/mixed/img/play-audio.svg"); } -.action-button[data-icon=source-term]::before { +button.action-button[data-icon=source-term]::before { background-image: url("/mixed/img/source-term.svg"); } -.entry[data-type=term][data-expression-multi=true] .actions>.action-play-audio { +.entry[data-type=term][data-expression-multi=true] .actions>button.action-button.action-play-audio { display: none; } @@ -949,10 +958,10 @@ button.action-button { } .term-definition-item::marker, .term-glossary-item::marker { - color: var(--light-text-color); + color: var(--text-color-light); } .term-definition-disambiguation-list { - color: var(--light-text-color); + color: var(--text-color-light); } .term-definition-disambiguation-list[data-count="0"] { display: none; @@ -1015,7 +1024,7 @@ button.action-button { } .term-pitch-accent-group::marker, .term-pitch-accent::marker { - color: var(--light-text-color); + color: var(--text-color-light); } .term-pitch-accent { display: list-item; @@ -1030,7 +1039,7 @@ button.action-button { } .term-pitch-accent-disambiguation-list { padding-right: 0.25em; - color: var(--light-text-color); + color: var(--text-color-light); } .term-pitch-accent-disambiguation-list::before { content: "("; @@ -1156,7 +1165,7 @@ button.action-button { display: table; table-layout: fixed; white-space: normal; - color: var(--light-text-color); + color: var(--text-color-light); } .term-glossary-item[data-has-image=true][data-image-load-state=load-error] .term-glossary-image-container-overlay::after { content: "Image failed to load"; @@ -1259,7 +1268,7 @@ button.action-button { list-style-type: none; } .kanji-glossary-item::marker { - color: var(--light-text-color); + color: var(--text-color-light); } @@ -1368,7 +1377,7 @@ button.action-button { height: 75%; } .frame-resizer-handle { - fill: var(--default-text-color); + fill: var(--text-color); opacity: 0.125; cursor: se-resize; pointer-events: auto; @@ -1468,7 +1477,7 @@ button.action-button { white-space: pre-wrap; content: var(--compact-list-separator); display: inline; - color: var(--light-text-color); + color: var(--text-color-light); } :root[data-glossary-layout-mode=compact] .entry:not([data-expression-multi=true]) .term-special-tags { display: none; @@ -1508,7 +1517,7 @@ button.action-button { white-space: pre-wrap; content: var(--compact-list-separator); display: inline; - color: var(--light-text-color); + color: var(--text-color-light); } :root[data-glossary-layout-mode=compact] .term-glossary-image-container { diff --git a/ext/mixed/css/material.css b/ext/mixed/css/material.css new file mode 100644 index 00000000..ff4730ae --- /dev/null +++ b/ext/mixed/css/material.css @@ -0,0 +1,845 @@ +/* + * Copyright (C) 2020 Yomichan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* Variables */ +:root { + --font-size-no-units: 14; + --font-size: calc(1px * var(--font-size-no-units)); + + --animation-duration: 0.125s; + --animation-duration2: calc(var(--animation-duration) * 2); + + --checkbox-size: calc(16em / var(--font-size-no-units)); + --icon-button-size: calc(36em / var(--font-size-no-units)); + --radio-size: calc(20em / var(--font-size-no-units)); + --toggle-size: calc(16em / var(--font-size-no-units)); + + --input-font-size-no-units: 1; + --input-font-size: calc(1em * var(--input-font-size-no-units)); + --input-width: calc(100em / (var(--font-size-no-units) * var(--input-font-size-no-units))); + --input-width-large: calc(200em / (var(--font-size-no-units) * var(--input-font-size-no-units))); + --input-height: calc(32em / (var(--font-size-no-units) * var(--input-font-size-no-units))); + --input-border-radius: 0.25em; + --textarea-line-height: 1.25em; + --textarea-padding: 0.5em; + + --material-arrow-dimension1: calc(5em / var(--font-size-no-units)); + --material-arrow-dimension2: calc(10em / var(--font-size-no-units)); + + --button-shadow-params: 0 0.0625em 0.125em 0; + + --thin-border-size: calc(1em / var(--font-size-no-units)); + + --text-color: #222222; + --background-color: #f8f9fa; + --background-color-light: #ffffff; + + --shadow-color: rgba(0, 0, 0, 0.185); + --shadow-color-off: rgba(0, 0, 0, 0); + --shadow-color-light: rgba(0, 0, 0, 0.085); + + --accent-color: #1a73e8; + --accent-color-light: #4a91ed; + --accent-color-lighter: #8db9f4; + --accent-color-lightest: #a7c9f6; + --accent-color-dark: #1060c0; + --accent-color-transparent0: rgba(28, 116, 233, 0); + --accent-color-transparent5: rgba(28, 116, 233, 0.05); + --accent-color-transparent25: rgba(28, 116, 233, 0.25); + + --danger-color: #c83c28; + --danger-color-light: #dd6755; + --danger-color-lighter: #e68d7f; + --danger-color-lightest: #eeb3aa; + --danger-color-transparent0: rgba(200, 60, 40, 0); + --danger-color-transparent5: rgba(200, 60, 40, 0.05); + --danger-color-transparent25: rgba(200, 60, 40, 0.25); + + --disabled-color: #aaaaaa; + --disabled-color-light: #dddddd; + --disabled-color-lighter: #eeeeee; + + --input-background-color: #f2f2f2; + --input-background-color-dark: #dddddd; + --input-background-color-darker: #cccccc; + --input-outline-color: var(--text-color); + + --button-text-color: #ffffff; + --button-border-color: #cccccc; + --button-icon-color: #333333; + --button-icon-color-light: #666666; + + --checkbox-checked-color: var(--accent-color); + --checkbox-unchecked-color: #666666; + --checkbox-check-color: var(--background-color-light); + --checkbox-disabled-color: var(--disabled-color); + + --toggle-track-color: #cccccc; + --toggle-knob-color: var(--background-color-light); + + --selectable-indicator-color: rgba(160, 160, 160, 0.25); +} +:root[data-theme=dark] { + --text-color: #d4d4d4; + --background-color: #1e1e1e; + --background-color-light: #0a0a0a; + + --shadow-color: rgba(255, 255, 255, 0.185); + --shadow-color-off: rgba(255, 255, 255, 0); + --shadow-color-light: rgba(255, 255, 255, 0.085); + + --accent-color: #4a91ed; + --accent-color-light: #1a73e8; + --accent-color-lighter: #135dbe; + --accent-color-lightest: #0e4690; + --accent-color-transparent0: rgb(78, 172, 253, 0); + --accent-color-transparent5: rgb(78, 172, 253, 0.05); + --accent-color-transparent25: rgb(78, 172, 253, 0.25); + + --danger-color: #dd6755; + --danger-color-light: #c83c28; + --danger-color-lighter: #9e301f; + --danger-color-lightest: #732317; + --danger-color-transparent0: rgba(221, 103, 85, 0); + --danger-color-transparent5: rgba(221, 103, 85, 0.05); + --danger-color-transparent25: rgba(221, 103, 85, 0.25); + + --disabled-color: #444444; + --disabled-color-light: #585858; + --disabled-color-lighter: #777777; + + --input-background-color: #2f2f2f; + --input-background-color-dark: #383838; + --input-background-color-darker: #484848; + --input-outline-color: var(--text-color); + + --button-text-color: #000000; + --button-border-color: #333333; + --button-icon-color: #cccccc; + --button-icon-color-light: #999999; + + --checkbox-unchecked-color: #999999; + + --toggle-track-color: #cccccc; + --toggle-knob-color: #ffffff; + + --selectable-indicator-color: rgba(100, 100, 100, 0.25); +} + + +/* Icons */ +.icon { + --icon-image: none; + --icon-size: contain; + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; + -webkit-mask-size: var(--icon-size); + -webkit-mask-image: var(--icon-image); + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + mask-size: var(--icon-size); + mask-image: var(--icon-image); +} +.icon[data-icon=profile] { --icon-image: url(/mixed/img/profile.svg); } +.icon[data-icon=cog] { --icon-image: url(/mixed/img/cog.svg); } +.icon[data-icon=palette] { --icon-image: url(/mixed/img/palette.svg); } +.icon[data-icon=popup] { --icon-image: url(/mixed/img/popup.svg); } +.icon[data-icon=speaker] { --icon-image: url(/mixed/img/speaker.svg); } +.icon[data-icon=scanning] { --icon-image: url(/mixed/img/scanning.svg); } +.icon[data-icon=text-parsing] { --icon-image: url(/mixed/img/text-parsing.svg); } +.icon[data-icon=translation] { --icon-image: url(/mixed/img/translation.svg); } +.icon[data-icon=book] { --icon-image: url(/mixed/img/book.svg); } +.icon[data-icon=note-card] { --icon-image: url(/mixed/img/note-card.svg); } +.icon[data-icon=keyboard] { --icon-image: url(/mixed/img/keyboard.svg); } +.icon[data-icon=backup] { --icon-image: url(/mixed/img/backup.svg); } +.icon[data-icon=lock] { --icon-image: url(/mixed/img/lock.svg); } +.icon[data-icon=question-mark] { --icon-image: url(/mixed/img/question-mark.svg); } +.icon[data-icon=popup-size] { --icon-image: url(/mixed/img/popup-size.svg); } +.icon[data-icon=hamburger-menu] { --icon-image: url(/mixed/img/hamburger-menu.svg); } +.icon[data-icon=kebab-menu] { --icon-image: url(/mixed/img/kebab-menu.svg); } +.icon[data-icon=mouse] { --icon-image: url(/mixed/img/mouse.svg); } +.icon[data-icon=material-down-arrow] { --icon-image: url(/mixed/img/material-down-arrow.svg); } +.icon[data-icon=material-right-arrow] { --icon-image: url(/mixed/img/material-right-arrow.svg); } +.icon[data-icon=exclamation-point-short] { --icon-image: url(/mixed/img/exclamation-point-short.svg); } +.icon[data-icon=magnifying-glass] { --icon-image: url(/mixed/img/magnifying-glass.svg); } +.icon[data-icon=collapse] { --icon-image: url(/mixed/img/collapse.svg); } +.icon[data-icon=expand] { --icon-image: url(/mixed/img/expand.svg); } +.icon[data-icon=window] { --icon-image: url(/mixed/img/window.svg); } + + +/* Checkbox */ +label.checkbox { + cursor: default; +} +.checkbox { + font-size: var(--checkbox-size); + display: inline-block; +} +.checkbox>input[type=checkbox] { + opacity: 0; + width: 0; + height: 0; + display: block; + margin: 0; + padding: 0; + border: none; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; +} +.checkbox-body { + display: block; + cursor: pointer; + width: 1em; + height: 1em; + position: relative; + cursor: pointer; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body { + cursor: default; +} +.checkbox-fill, +.checkbox-border, +.checkbox-check { + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + mask-size: contain; + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; + -webkit-mask-size: contain; + transition: opacity var(--animation-duration) linear, background-color var(--animation-duration) linear; +} +.checkbox-fill { + mask-image: url(/mixed/img/checkbox-fill.svg); + -webkit-mask-image: url(/mixed/img/checkbox-fill.svg); + background-color: var(--checkbox-unchecked-color); + opacity: 0; +} +.checkbox-border { + mask-image: url(/mixed/img/checkbox-border.svg); + -webkit-mask-image: url(/mixed/img/checkbox-border.svg); + background-color: var(--checkbox-unchecked-color); + opacity: 1; +} +.checkbox-check { + mask-image: url(/mixed/img/checkbox-check.svg); + -webkit-mask-image: url(/mixed/img/checkbox-check.svg); + background-color: var(--checkbox-check-color); + opacity: 0; +} +.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-fill { + background-color: var(--checkbox-checked-color); + opacity: 1; +} +.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-border { + background-color: var(--checkbox-checked-color); + opacity: 1; +} +.checkbox>input[type=checkbox]:checked+.checkbox-body>.checkbox-check { + background-color: var(--checkbox-check-color); + opacity: 1; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-fill { + opacity: 0; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-border { + background-color: var(--checkbox-disabled-color); + opacity: 1; +} +.checkbox>input[type=checkbox]:disabled+.checkbox-body>.checkbox-check { + background-color: var(--checkbox-disabled-color); +} + + +/* Toggle switch */ +label.toggle { + cursor: default; +} +.toggle { + font-size: var(--toggle-size); + display: inline-block; +} +.toggle>input[type=checkbox] { + opacity: 0; + width: 0; + height: 0; + display: block; + margin: 0; + padding: 0; + border: none; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; +} +.toggle-body { + display: block; + cursor: pointer; + width: 2em; + height: 1em; + position: relative; +} +.toggle-track { + display: block; + position: absolute; + left: 0.125em; + right: 0.125em; + top: 0.125em; + bottom: 0.125em; + background-color: var(--toggle-track-color); + border-radius: 0.4375em; + transition: background-color var(--animation-duration) ease-in-out; +} +.toggle-knob { + display: block; + position: absolute; + left: 0; + top: 0; + width: 1em; + height: 1em; + background-color: var(--toggle-knob-color); + border-radius: 0.5em; + box-shadow: + 0 0.0625em 0.25em 0 var(--shadow-color), + 0 0.125em 0.125em 0 var(--shadow-color); + transition: transform var(--animation-duration) ease-in-out, + background-color var(--animation-duration) ease-in-out; +} +.toggle-body>.toggle-knob::after { + position: absolute; + display: block; + content: ""; + left: -0.75em; + top: -0.75em; + right: -0.75em; + bottom: -0.75em; + border-radius: 2.5em; + background-color: var(--selectable-indicator-color); + pointer-events: none; + transform: scale(0); + opacity: 0; + visibility: hidden; + transition: transform 0s ease-in-out var(--animation-duration2), + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.toggle>input[type=checkbox]:focus:not(:disabled)+.toggle-body>.toggle-knob::after, +.toggle:active>input[type=checkbox]:not(:disabled)+.toggle-body>.toggle-knob::after { + transform: scale(1); + opacity: 1; + visibility: visible; + transition: transform var(--animation-duration2) ease-in-out, + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.toggle>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { + opacity: 0.5; +} +.toggle:active>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { + opacity: 1; +} +.toggle>input[type=checkbox]:checked+.toggle-body>.toggle-knob { + transform: translateX(1em); +} +.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-track { + background-color: var(--accent-color-lighter); +} +.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob { + background-color: var(--accent-color); +} +.toggle>input[type=checkbox]:focus:checked:not(:disabled)+.toggle-body>.toggle-knob::after, +.toggle:active>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob::after { + background-color: var(--accent-color-transparent25); +} +.toggle>input[type=checkbox]:disabled+.toggle-body { + cursor: default; +} +.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-track { + background-color: var(--disabled-color-light); +} +.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-knob { + background-color: var(--disabled-color-lighter); +} + + +/* Radio button */ +label.radio { + cursor: default; +} +.radio { + display: inline-block; + vertical-align: middle; +} +.radio>input[type=radio] { + opacity: 0; + width: 0; + height: 0; + display: block; + margin: 0; + padding: 0; + border: none; + cursor: default; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; +} +.radio>input[type=radio]:not(:disabled)+.radio-body { + cursor: pointer; +} +.radio-body { + display: block; + position: relative; + width: var(--radio-size); + height: var(--radio-size); +} +.radio-border, +.radio-dot { + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + background-color: var(--accent-color); + mask-repeat: no-repeat; + mask-position: center center; + mask-mode: alpha; + mask-size: var(--radio-size) var(--radio-size); + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center center; + -webkit-mask-mode: alpha; + -webkit-mask-size: var(--radio-size) var(--radio-size); +} +.radio-border { + mask-image: url(/mixed/img/radio-button.svg); + -webkit-mask-image: url(/mixed/img/radio-button.svg); +} +.radio-dot { + mask-image: url(/mixed/img/radio-button-dot.svg); + -webkit-mask-image: url(/mixed/img/radio-button-dot.svg); + opacity: 1; + transform: none; + transition: transform var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.radio>input[type=radio]:disabled+.radio-body>.radio-border, +.radio>input[type=radio]:disabled+.radio-body>.radio-dot { + background-color: var(--disabled-color); +} +.radio>input[type=radio]:not(:checked)+.radio-body>.radio-dot { + opacity: 0; + transform: scale(0); + transition: transform 0s ease-in-out var(--animation-duration2), + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.radio-body::after { + position: absolute; + display: block; + content: ""; + left: -0.75em; + top: -0.75em; + right: -0.75em; + bottom: -0.75em; + border-radius: 2.5em; + background-color: var(--selectable-indicator-color); + pointer-events: none; + transform: scale(0); + opacity: 0; + visibility: hidden; + transition: transform 0s ease-in-out var(--animation-duration2), + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.radio>input[type=radio]:focus:not(:disabled)+.radio-body::after, +.radio:active>input[type=radio]:not(:disabled)+.radio-body::after { + transform: scale(1); + opacity: 1; + visibility: visible; + transition: transform var(--animation-duration2) ease-in-out, + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.radio>input[type=radio]:focus+.radio-body::after { + opacity: 0.5; +} +.radio:active>input[type=radio]:focus+.radio-body::after { + opacity: 1; +} +.radio-label { + cursor: pointer; + white-space: nowrap; +} +.radio-label>.radio { + vertical-align: middle; +} +.radio-label>.radio-label-text { + display: inline-block; + margin-left: 0.5em; + vertical-align: middle; + white-space: normal; +} + + +/* Material design select */ +select { + width: var(--input-width-large); + height: var(--input-height); + line-height: var(--input-height); + border: 0; + border-radius: var(--input-border-radius); + box-sizing: border-box; + padding: 0 0.5em; + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; + background-image: url(/mixed/img/material-down-arrow.svg); + background-repeat: no-repeat; + background-position: right calc(10em / var(--font-size-no-units)) center; + background-color: var(--input-background-color); + background-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); + cursor: pointer; + color: var(--text-color); + font-size: var(--input-font-size); +} +select::-ms-expand { + display: none; +} + + +/* Material design inputs */ +input[type=text], +input[type=number] { + width: var(--input-width); + height: var(--input-height); + line-height: var(--input-height); + color: var(--text-color); + font-size: var(--input-font-size); + background-color: var(--input-background-color); + border: none; + border-radius: var(--input-border-radius); + box-sizing: border-box; + padding: 0 0.5em; + appearance: textfield; + -moz-appearance: textfield; + -webkit-appearance: textfield; +} +input[type=number]::-webkit-inner-spin-button, +input[type=number]::-webkit-outer-spin-button { + appearance: none; + -moz-appearance: none; + -webkit-appearance: none; + margin: 0; +} +input[type=text] { + width: var(--input-width-large); +} +textarea { + box-sizing: border-box; + padding: var(--textarea-padding); + font-family: 'Courier New', Courier, monospace; + color: var(--text-color); + font-size: var(--input-font-size); + background-color: var(--input-background-color); + border-radius: var(--input-border-radius); + line-height: var(--textarea-line-height); + border: var(--thin-border-size) solid var(--input-background-color); +} +select:invalid, +textarea:invalid, +input[type=text]:invalid, +input[type=number]:invalid, +select[data-invalid=true], +textarea[data-invalid=true], +input[type=text][data-invalid=true], +input[type=number][data-invalid=true] { + border: var(--thin-border-size) solid var(--danger-color); +} +select, +textarea, +input[type=text], +input[type=number] { + box-shadow: none; + transition: box-shadow calc(var(--animation-duration) / 2) linear; +} +select:focus, +textarea:focus, +input[type=text]:focus, +input[type=number]:focus { + box-shadow: 0 0 0 calc(2em / var(--font-size-no-units)) var(--input-outline-color); + outline: none; +} +select:invalid:focus, +textarea:invalid:focus, +input[type=text]:invalid:focus, +input[type=number]:invalid:focus, +select[data-invalid=true]:focus, +textarea[data-invalid=true]:focus, +input[type=text][data-invalid=true]:focus, +input[type=number][data-invalid=true]:focus { + box-shadow: 0 0 0 calc(2em / var(--font-size-no-units)) var(--danger-color); + outline: none; +} +input[type=text].input-with-suffix-button, +input[type=number].input-with-suffix-button { + flex: 1 1 auto; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + border-right-style: none; + z-index: 1; +} + + +/* Material design button */ +button { + border: var(--thin-border-size) solid transparent; + border-radius: 0.3em; + padding: 0.5em 1em; + font-weight: bold; + font-size: inherit; + font-family: inherit; + cursor: pointer; + background-color: transparent; + box-shadow: var(--button-shadow-params) var(--shadow-color-off); + transition: background-color var(--animation-duration) ease-in, box-shadow var(--animation-duration) ease-in, border-color var(--animation-duration) ease-in; + -webkit-tap-highlight-color: transparent; +} +button:focus { + outline: none; +} +button:hover { + transition: background-color var(--animation-duration) ease-out, box-shadow var(--animation-duration) ease-out, border-color var(--animation-duration) ease-out; +} +button:hover:not(:disabled) { + box-shadow: var(--button-shadow-params) var(--shadow-color-light); +} +button:active:not(:disabled) { + box-shadow: var(--button-shadow-params) var(--shadow-color); +} + +/* Standard button */ +button:not(:disabled) { + color: var(--button-text-color); + border-color: var(--accent-color); + background-color: var(--accent-color); +} +button:hover:not(:disabled) { + background-color: var(--accent-color-light); + border-color: var(--accent-color-light); +} +button:focus:not(:disabled) { + background-color: var(--accent-color-light); +} +button:active:not(:disabled) { + border-color: var(--accent-color-lighter); + background-color: var(--accent-color-lighter); +} + +/* Standard danger button */ +button.danger:not(:disabled) { + color: var(--button-text-color); + border-color: var(--danger-color); + background-color: var(--danger-color); +} +button.danger:hover:not(:disabled) { + background-color: var(--danger-color-light); + border-color: var(--danger-color-light); +} +button.danger:focus:not(:disabled) { + background-color: var(--danger-color-light); +} +button.danger:active:not(:disabled) { + border-color: var(--danger-color-lighter); + background-color: var(--danger-color-lighter); +} + +/* Low emphasis button */ +button.low-emphasis:not(:disabled) { + color: var(--accent-color); + border-color: var(--button-border-color); + background-color: var(--accent-color-transparent0); +} +button.low-emphasis:hover:not(:disabled) { + background-color: var(--accent-color-transparent5); + border-color: var(--accent-color-light); +} +button.low-emphasis:focus:not(:disabled) { + border-color: var(--accent-color); +} +button.low-emphasis:active:not(:disabled) { + border-color: var(--accent-color); + background-color: var(--accent-color-transparent25); +} + +/* Low emphasis danger button */ +button.low-emphasis.danger:not(:disabled) { + color: var(--danger-color); + border-color: var(--button-border-color); + background-color: var(--danger-color-transparent0); +} +button.low-emphasis.danger:hover:not(:disabled) { + border-color: var(--danger-color-light); + background-color: var(--danger-color-transparent5); +} +button.low-emphasis.danger:focus:not(:disabled) { + border-color: var(--danger-color); +} +button.low-emphasis.danger:active:not(:disabled) { + border-color: var(--danger-color); + background-color: var(--danger-color-transparent25); +} + +/* Disabled buttons */ +button:disabled { + color: var(--button-text-color); + border-color: var(--disabled-color); + background-color: var(--disabled-color); + cursor: default; +} +button.low-emphasis:disabled { + color: var(--disabled-color); + border-color: var(--disabled-color); + background-color: transparent; +} + +/* Input suffix button */ +button.input-suffix-button { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + border: none; + height: var(--input-height); + line-height: var(--input-height); + background-color: var(--input-background-color); + box-sizing: border-box; + padding: 0 0.5em; + border-color: transparent; +} +button.input-suffix-button.input-suffix-icon-button { + width: 2.125em; + position: relative; +} +button.input-suffix-button.input-suffix-icon-button:hover, +button.input-suffix-button.input-suffix-icon-button:focus { + background-color: var(--input-background-color-dark); +} +button.input-suffix-button.input-suffix-icon-button:active { + background-color: var(--input-background-color-darker); +} +input[type=text]:invalid+button.input-suffix-button, +input[type=number]:invalid+button.input-suffix-button, +input[type=text][data-invalid=true]+button.input-suffix-button, +input[type=number][data-invalid=true]+button.input-suffix-button { + border: var(--thin-border-size) solid var(--danger-color); + border-left-style: none; +} + + +/* Material design icon button */ +button.icon-button { + display: inline-block; + vertical-align: middle; + border: none; + margin: 0; + padding: 0; + box-sizing: content-box; + font-size: inherit; + cursor: pointer; + background-color: transparent; +} +button.icon-button>.icon-button-inner { + display: block; + width: var(--icon-button-size); + height: var(--icon-button-size); + position: relative; +} +button.icon-button:focus { + outline: none; +} +button.icon-button, +button.icon-button:hover, +button.icon-button:focus, +button.icon-button:active { + background-color: transparent; + box-shadow: none; +} +.icon-button>.icon-button-inner::after { + position: absolute; + display: block; + content: ""; + left: 0; + top: 0; + right: 0; + bottom: 0; + border-radius: 50%; + background-color: var(--selectable-indicator-color); + pointer-events: none; + transform: scale(0); + opacity: 0; + visibility: hidden; + transition: transform 0s ease-in-out var(--animation-duration2), + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility 0s ease-in-out var(--animation-duration2); +} +.icon-button:focus>.icon-button-inner::after { + transform: scale(1); + opacity: 1; + visibility: visible; + transition: transform var(--animation-duration2) ease-in-out, + background-color var(--animation-duration2) ease-in-out, + opacity var(--animation-duration2) ease-in-out, + visibility var(--animation-duration2) ease-in-out; +} +.icon-button>.icon-button-inner>.icon { + display: block; + position: absolute; + left: 0; + top: 0; + right: 0; + bottom: 0; + background-color: var(--button-icon-color); + --icon-size: calc(16em / var(--font-size-no-units)) calc(16em / var(--font-size-no-units)); +} +.icon-button>.icon-button-inner>.icon.icon-button-icon-light { + background-color: var(--button-icon-color-light); +} +.icon-button>.icon-button-inner>.icon[data-icon=material-right-arrow] { --icon-size: var(--material-arrow-dimension1) var(--material-arrow-dimension2); } +.icon-button>.icon-button-inner>.icon[data-icon=material-down-arrow] { --icon-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); } + +.input-height-icon-button-container { + height: var(--input-height); + box-sizing: border-box; +} +.input-height-icon-button-container>.icon-button { + position: relative; + top: calc((var(--input-height) - var(--icon-button-size)) * 0.5); +} + diff --git a/ext/mixed/css/search.css b/ext/mixed/css/search.css index ad4a2ae7..3812a569 100644 --- a/ext/mixed/css/search.css +++ b/ext/mixed/css/search.css @@ -20,58 +20,17 @@ --main-content-horizontal-padding: 0.72em; --entry-horizontal-padding: 0; - --padding: 10px; - --main-content-size: 700px; - --shadow-color: rgba(0, 0, 0, 0.185); - --shadow-vertical: 0 1px 4px 0 var(--shadow-color), 0 2px 2px 0 var(--shadow-color); + --padding: calc(10em / var(--font-size-no-units)); + --main-content-size: calc(700em / var(--font-size-no-units)); - --toggle-size: 16px; - - --textarea-line-height: 1.25em; - --textarea-padding: 0.5em; - - --animation-duration: 0s; - --animation-duration2: calc(var(--animation-duration) * 2); - - --material-arrow-dimension1: 5px; - --material-arrow-dimension2: 10px; - --input-height: 32px; - --input-width-large: 200px; - - --text-color-default: #222222; --background-color: #ffffff; - --background-color-light: #ffffff; - --input-background-color: #f2f2f2; - --input-background-color-dark: #dddddd; - --input-background-color-darker: #cccccc; --separator-color1: #cccccc; - --button-icon-color: #333333; - --toggle-track-color: #cccccc; - --toggle-knob-color: #ffffff; - --selectable-indicator-color: rgba(160, 160, 160, 0.25); - --disabled-color: #aaaaaa; - --disabled-color-light: #dddddd; - --disabled-color-lighter: #eeeeee; - --accent-color: #1a73e8; - --accent-color-lighter: #8db9f4; - --accent-color-transparent25: rgba(28, 116, 233, 0.25); } -:root[data-loaded=true] { - --animation-duration: 0.125s; +:root:not([data-loaded=true]) { + --animation-duration: 0s; } :root[data-theme=dark] { - --text-color-default: #d8d8d8; - --background-color: #1e1e1e; - --shadow-color: rgba(255, 255, 255, 0.185); - --separator-color1: #cccccc; - --input-background-color: #2f2f2f; - --input-background-color-dark: #383838; - --input-background-color-darker: #484848; - --selectable-indicator-color: rgba(100, 100, 100, 0.25); - --button-icon-color: #cccccc; - --disabled-color: #444444; - --disabled-color-light: #585858; - --disabled-color-lighter: #777777; + --separator-color1: #333333; } /* Common styles */ @@ -84,7 +43,7 @@ body { padding: 0; margin: 0; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - color: var(--text-color-default); + color: var(--text-color); height: 100%; overflow: hidden; } @@ -98,155 +57,6 @@ h1 { border-bottom: calc(1em / (var(--font-size-no-units) * 2)) solid var(--separator-color1); } -/* Icons */ -.icon { - --icon-image: none; - --icon-size: contain; - -webkit-mask-repeat: no-repeat; - -webkit-mask-position: center center; - -webkit-mask-mode: alpha; - -webkit-mask-size: var(--icon-size); - -webkit-mask-image: var(--icon-image); - mask-repeat: no-repeat; - mask-position: center center; - mask-mode: alpha; - mask-size: var(--icon-size); - mask-image: var(--icon-image); -} -.icon[data-icon=magnifying-glass] { --icon-image: url(/mixed/img/magnifying-glass.svg); } - -/* Material design select */ -select { - width: var(--input-width-large); - height: var(--input-height); - line-height: var(--input-height); - border: 0; - border-radius: 0; - box-sizing: border-box; - padding: 0 0.5em; - -webkit-appearance: none; - -moz-appearance: none; - appearance: none; - background-image: url(/mixed/img/material-down-arrow.svg); - background-repeat: no-repeat; - background-position: right var(--padding) center; - background-color: var(--input-background-color); - background-size: var(--material-arrow-dimension2) var(--material-arrow-dimension1); - cursor: pointer; - outline: 0; -} -select::-ms-expand { - display: none; -} - -/* Material design toggle switch */ -label.toggle { - cursor: default; -} -.toggle { - font-size: var(--toggle-size); - display: inline-block; -} -.toggle>input[type=checkbox] { - opacity: 0; - width: 0; - height: 0; - display: block; - margin: 0; - padding: 0; - border: none; - appearance: none; - -moz-appearance: none; -} -.toggle-body { - display: block; - cursor: pointer; - width: 2em; - height: 1em; - position: relative; -} -.toggle-track { - display: block; - position: absolute; - left: 0.125em; - right: 0.125em; - top: 0.125em; - bottom: 0.125em; - background-color: var(--toggle-track-color); - border-radius: 0.4375em; - transition: background-color var(--animation-duration) ease-in-out; -} -.toggle-knob { - display: block; - position: absolute; - left: 0; - top: 0; - width: 1em; - height: 1em; - background-color: var(--toggle-knob-color); - border-radius: 0.5em; - box-shadow: var(--shadow-vertical); - transition: transform var(--animation-duration) ease-in-out, - background-color var(--animation-duration) ease-in-out; -} -.toggle-body>.toggle-knob::after { - position: absolute; - display: block; - content: ""; - left: -0.75em; - top: -0.75em; - right: -0.75em; - bottom: -0.75em; - border-radius: 2.5em; - background-color: var(--selectable-indicator-color); - pointer-events: none; - transform: scale(0); - opacity: 0; - visibility: hidden; - transition: transform 0s ease-in-out var(--animation-duration2), - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility 0s ease-in-out var(--animation-duration2); -} -.toggle>input[type=checkbox]:focus:not(:disabled)+.toggle-body>.toggle-knob::after, -.toggle:active>input[type=checkbox]:not(:disabled)+.toggle-body>.toggle-knob::after { - transform: scale(1); - opacity: 1; - visibility: visible; - transition: transform var(--animation-duration2) ease-in-out, - background-color var(--animation-duration2) ease-in-out, - opacity var(--animation-duration2) ease-in-out, - visibility var(--animation-duration2) ease-in-out; -} -.toggle>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { - opacity: 0.5; -} -.toggle:active>input[type=checkbox]:focus+.toggle-body>.toggle-knob::after { - opacity: 1; -} -.toggle>input[type=checkbox]:checked+.toggle-body>.toggle-knob { - transform: translateX(1em); -} -.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-track { - background-color: var(--accent-color-lighter); -} -.toggle>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob { - background-color: var(--accent-color); -} -.toggle>input[type=checkbox]:focus:checked:not(:disabled)+.toggle-body>.toggle-knob::after, -.toggle:active>input[type=checkbox]:checked:not(:disabled)+.toggle-body>.toggle-knob::after { - background-color: var(--accent-color-transparent25); -} -.toggle>input[type=checkbox]:disabled+.toggle-body { - cursor: default; -} -.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-track { - background-color: var(--disabled-color-light); -} -.toggle>input[type=checkbox]:disabled+.toggle-body>.toggle-knob { - background-color: var(--disabled-color-lighter); -} - /* Content layout */ .content-body-inner { width: var(--main-content-size); @@ -266,7 +76,7 @@ label.toggle { border: 0; } #search-textbox { - color: var(--text-color-default); + color: var(--text-color); flex: 1 1 auto; box-sizing: border-box; padding: var(--textarea-padding); @@ -283,8 +93,9 @@ label.toggle { resize: vertical; font-size: var(--font-size); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - color: var(--text-color-default); + color: var(--text-color); white-space: pre-wrap; + z-index: 1; } #search-button { flex: 0 0 auto; @@ -297,6 +108,8 @@ label.toggle { cursor: pointer; outline: none; transition: background-color var(--animation-duration) ease-in-out; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } #search-button:hover, #search-button:focus { -- cgit v1.2.3