//// /// Defines themes that mimic the material design specification. /// @author Carl Stephens //// :root { // Set these to adjust the colour palette --primary-bg-color-l1: 36, 156, 207; --primary-bg-color: 33, 145, 192; --primary-fg-color: 255, 255, 255; --accent-bg-color: 25, 118, 158; --accent-fg-color: 255, 255, 255; // For components that are in a disabled state. --primary-disabled-color-raw: 130, 130, 130; // Main font color --body-color: rgb(39, 39, 39); // For the paper style, but more generally the neutral background color --paper-color: #FCFCFC; --body-font-family: Arial, sans-serif; --primary-box-shadow: 0 2px 4px 0 #505050; --primary-box-shadow-thin: 0 1px 3px 0 #666666; // The brightness to reduce participating elements to on hover --hover-brightness: 92%; --border-radius: 0.3em; --transition-duration: 0.15s; // Default theme @extend .theme-primary; } /* Scrollbar replacement */ ::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: #f1f1f1; } ::-webkit-scrollbar-thumb { background: #CCC; border-radius: 3px; transition-duration: var(--transition-duration); &:hover { background: #666; height: 8px; width: 8px; } } /* === Start component definitions === */ .paper { padding: 1.2em; border-radius: var(--border-radius); background-color: var(--paper-color); color: var(--body-color); box-shadow: var(--primary-box-shadow); } .card { @extend .paper; box-shadow: var(--primary-box-shadow-thin); } .card-outlined { @extend .card; box-shadow: none; border: 1px solid #BBB; } .divider { height: 1px; background-color: #0000001F; border: none; margin: 1rem 2rem; } .divider-s { @extend .divider; margin: 0 2rem; } /* Buttons */ .btn-primary { appearance: none; display: flex; align-items: center; justify-content: center; background-color: var(--bg-color); color: var(--fg-color); border: none; box-shadow: var(--primary-box-shadow-thin); border-radius: var(--border-radius); padding: 0.5em; cursor: pointer; font-size: 1rem; font-weight: 400; text-decoration: none; transition-duration: var(--transition-duration); &:hover { filter: brightness(var(--hover-brightness)); } &:disabled { cursor: default; background-color: var(--disabled-color); } } .btn-fab { @extend .btn-primary; border-radius: 50%; padding: 0.3em; } /** Text display/input */ .text-container { display: flex; flex-wrap: wrap; align-content: flex-start; align-items: flex-start; border-radius: var(--border-radius); background: #DDD; padding: 0.5em; } .text-container-sl { @extend .text-container; align-items: center; overflow-x: auto; overflow-y: hidden; white-space: nowrap; } .text-input { @extend .text-container; border-radius: var(--border-radius) var(--border-radius) 0 0; border: none; border-bottom: 2px solid #999; outline: none; cursor: text; font-family: var(--body-font-family); font-size: 1em; transition: border var(--transition-duration); &:hover { background-color: #CDCDCD; } &:active, &:focus, &:focus-visible { background-color: #CDCDCD; border-bottom: 2px solid var(--bg-color); .text-input-active { width: 100%; } } .text-input-active { background-color: var(--bg-color); height: 1px; margin: 0 auto; width: 0; transition-duration: var(--transition-duration); } } .text-input-sl { @extend .text-input; align-items: center; overflow-x: auto; overflow-y: hidden; white-space: nowrap; } .text-placeholder { color: #666; cursor: inherit; font-style: italic; cursor: inherit; user-select: none; } /* Switches */ // https://codepen.io/avstorm/pen/jOEpBLW .switch { -webkit-appearance: none; -moz-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; cursor: pointer; height: 16px; width: 38px; border-radius: 8px; display: inline-block; position: relative; margin: 6px; background-color: #c7c7c7; transition-duration: var(--transition-duration); &:focus { outline: 0; } &::after { content: ''; position: absolute; display: inline-block; top: -4px; left: -4px; width: 24px; height: 24px; border-radius: 50%; background: white; box-shadow: var(--primary-box-shadow-thin); transition-duration: var(--transition-duration); } &:checked { background-color: rgba(var(--bg-color-raw), 0.4); &::after { transform: translatex(22px); background-color: var(--bg-color); } } } /* Sliders */ @mixin slider-clear { appearance: none; width: 100%; // Required for firefox &::-webkit-slider-thumb { -webkit-appearance: none; } &::-moz-range-track { outline: none; } &::-ms-track { width: 100%; background: transparent; border-color: transparent; color: transparent; } } @mixin slider-thumb { height: 24px; width: 24px; border-radius: 50%; cursor: pointer; background-color: var(--bg-color); box-shadow: var(--primary-box-shadow-thin); &:hover { filter: brightness(var(--hover-brightness)); } } @mixin disabled-slider-thumb { cursor: default; background-color: var(--disabled-color); &:hover { filter: none; } } .slider-continuous { @include slider-clear(); margin: 0; padding: 0; height: 8px; border-radius: 4px; background-color: rgba(var(--bg-color-raw), 0.3); transition-duration: var(--transition-duration); &::-webkit-slider-thumb { @include slider-thumb() } &::-moz-range-thumb { @include slider-thumb() } &::-ms-thumb { @include slider-thumb() } &:hover { background-color: rgba(var(--bg-color-raw), 0.4); } } .slider-continuous:disabled { background-color: var(--disabled-color); &::-webkit-slider-thumb { @include disabled-slider-thumb(); } &::-moz-range-thumb { @include disabled-slider-thumb(); } &::-ms-thumb { @include disabled-slider-thumb(); } &:hover { background-color: var(--disabled-color); } } /* List Views */ .list-view { list-style-type: none; margin-block: 0 0; padding-inline: 0 0; } .list-view__item { padding: 0.2em 0.5em; transition-duration: var(--transition-duration); &:hover { background-color: #EEE; } } /* Progress Bars */ .progress-circle-indeterminate { height: 2em; width: 2em; border: 0.25em solid var(--bg-color); border-right: 0.25em solid rgba(var(--bg-color-raw), 0.3); border-radius: 50%; animation: rotate360 1.5s linear 0s infinite running; } @keyframes rotate360 { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .progress-bar-container { width: 100%; height: 8px; overflow: hidden; background-color: rgba(var(--bg-color-raw), 0.2); border-radius: 4px; } .progress-bar-value { height: 100%; background-color: var(--bg-color); border-radius: 4px; } .progress-bar-indeterminate { width: 20%; animation: 2s ease 0s infinite alternate prgbr-indeterminate; } @keyframes prgbr-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(500%); } } /* === End component definitions === */ /* Font sizes */ .body0 { font-size: 18px; line-height: 24px; } .body1 { font-size: 16px; } .body2 { font-size: 14px; } .heading1 { font-size: 40px; font-weight: 300; } /* === Start Theme Definitions === */ .theme-primary { --bg-color: rgb(var(--primary-bg-color)); --bg-color-raw: var(--primary-bg-color); --fg-color: rgb(var(--primary-fg-color)); --fg-color-faw: var(--primary-fg-color); --disabled-color: rgb(var(--primary-disabled-color-raw)); --disabled-color-raw: var(--primary-disabled-color-raw); } .theme-primary-l1 { --bg-color: rgb(var(--primary-bg-color-l1)); --bg-color-raw: var(--primary-bg-color-l1); --fg-color: rgb(var(--primary-fg-color)); --fg-color-raw: var(--primary-fg-color); } .theme-error { --bg-color: #f04848; --bg-color-raw: 240, 72, 72; } .theme-flat { --bg-color: transparent; --bg-color-raw: transparent; --fg-color: rgb(var(--primary-bg-color)); --fg-color-raw: var(--primary-bg-color); --disabled-color: transparent; --disabled-color-raw: transparent; box-shadow: none; &:hover { --bg-color: rgba(var(--primary-bg-color), 0.15); } &:disabled { --fg-color: rgb(var(--primary-disabled-color-raw)); --fg-color-raw: var(--primary-disabled-color-raw); } } .theme-accent { --bg-color: rgb(var(--accent-bg-color)); --bg-color-raw: var(--accent-bg-color); --fg-color: rgb(var(--accent-fg-color)); --fg-color-raw: var(--accent-fg-color); } /* === End theme definitions === */