diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sass/base.scss | 6 | ||||
-rw-r--r-- | src/sass/components/badges.scss | 2 | ||||
-rw-r--r-- | src/sass/components/captions.scss | 1 | ||||
-rw-r--r-- | src/sass/components/control.scss | 2 | ||||
-rw-r--r-- | src/sass/lib/css-vars.scss | 97 | ||||
-rw-r--r-- | src/sass/settings/colors.scss | 2 | ||||
-rw-r--r-- | src/sass/settings/controls.scss | 2 | ||||
-rw-r--r-- | src/sass/settings/type.scss | 20 |
8 files changed, 58 insertions, 74 deletions
diff --git a/src/sass/base.scss b/src/sass/base.scss index 9bb9d98a..84861e99 100644 --- a/src/sass/base.scss +++ b/src/sass/base.scss @@ -7,10 +7,10 @@ @include plyr-font-smoothing($plyr-font-smoothing); direction: ltr; - font-family: $plyr-font-family; + font-family: var(--plyr-font-family); font-variant-numeric: tabular-nums; // Force monosace-esque number widths - font-weight: $plyr-font-weight-regular; - line-height: $plyr-line-height; + font-weight: var(--plyr-font-weight-regular); + line-height: var(--plyr-line-height); max-width: 100%; min-width: 200px; position: relative; diff --git a/src/sass/components/badges.scss b/src/sass/components/badges.scss index 3a9a28b5..46c87d03 100644 --- a/src/sass/components/badges.scss +++ b/src/sass/components/badges.scss @@ -6,7 +6,7 @@ background: $plyr-badge-bg; border-radius: 2px; color: $plyr-badge-color; - font-size: $plyr-font-size-badge; + font-size: var(--plyr-font-size-badge); line-height: 1; padding: 3px 4px; } diff --git a/src/sass/components/captions.scss b/src/sass/components/captions.scss index b8e2d771..d7951b96 100644 --- a/src/sass/components/captions.scss +++ b/src/sass/components/captions.scss @@ -56,4 +56,3 @@ .plyr:not(.plyr--hide-controls) .plyr__controls:not(:empty) ~ .plyr__captions { transform: translateY(-($plyr-control-spacing * 4)); } - diff --git a/src/sass/components/control.scss b/src/sass/components/control.scss index eedcab13..ee24604e 100644 --- a/src/sass/components/control.scss +++ b/src/sass/components/control.scss @@ -82,7 +82,7 @@ a.plyr__control { border: 0; border-radius: 100%; box-shadow: 0 1px 1px rgba(#000, 0.15); - color: var(--plyr-video-control-color); + color: var(--plyr-video-control-color-hover); display: none; left: 50%; padding: ceil($plyr-control-spacing * 1.5); diff --git a/src/sass/lib/css-vars.scss b/src/sass/lib/css-vars.scss index cb251831..074c27c1 100644 --- a/src/sass/lib/css-vars.scss +++ b/src/sass/lib/css-vars.scss @@ -1,6 +1,4 @@ -// Downloaded from https://github.com/malyw/css-vars - -//// VARIABLES //// +// Downloaded from https://github.com/malyw/css-vars (and modified) // global map to be filled via variables $css-vars: (); @@ -9,29 +7,16 @@ $css-vars: (); // so native CSS custom properties will be used instead of the Sass global map $css-vars-use-native: false !default; -// enables the output of debug messages -$css-vars-debug-log: false !default; - -//// FUNCTIONS //// - /// // Assigns a variable to the global map /// -@function _cssVarAssign($varName: null, $varValue: null) { - // CHECK PARAMS - @if ($varName==null) { - @error 'Variable name is expected, instead got: null'; - } - @if ($varValue==null) { - @error 'Variable value is expected, instead got: null'; - } - - // assign to the global map - @if ($css-vars-debug-log and map-get($css-vars, $varName)) { - @debug "'#{$varName}' variable is reassigned"; - } - - @return map-merge($css-vars, ($varName: $varValue)); +@function css-var-assign($varName: null, $varValue: null) { + @return map-merge( + $css-vars, + ( + $varName: $varValue, + ) + ); } /// @@ -54,42 +39,28 @@ $css-vars-debug-log: false !default; } // PROCESS - $varName: nth($args, 1); - $varValue: map-get($css-vars, $varName); - - @if ($css-vars-debug-log or not $css-vars-use-native) { - // Sass or debug - @if ($varValue==null) { - // variable is not provided so far - @if (length($args) ==2) { - // the default value is passed - @if ($css-vars-debug-log) { - @debug "Provided default value is used for the variable: '#{$varName}'"; - } - $varValue: nth($args, 2); - } @else if ($css-vars-debug-log) { - @debug "Variable '#{$varName}' is not assigned"; - @if (not $css-vars-use-native) { - @debug "The 'var(#{$varName}...)' usage will be skipped in the output CSS"; - } - } - } - } + $var-name: nth($args, 1); + $var-value: map-get($css-vars, $var-name); @if ($css-vars-use-native) { // CSS variables // Native CSS: don't process function in case of native @return unquote('var(' + $args + ')'); } @else { + @if ($var-value == null) { + // variable is not provided so far + @if (length($args) == 2) { + $var-value: nth($args, 2); + } + } + // Sass: return value from the map - @return $varValue; + @return $var-value; } } -//// MIXIN //// - /// -// CSS mixin to provide variables +// SASS mixin to provide variables // E.G.: // @include css-vars(( // --color: rebeccapurple, @@ -97,35 +68,33 @@ $css-vars-debug-log: false !default; // --margin-top: calc(2vh + 20px) // )); /// -@mixin css-vars($varMap: null) { +@mixin css-vars($var-map: null) { // CHECK PARAMS - @if ($varMap==null) { + @if ($var-map == null) { @error 'Map of variables is expected, instead got: null'; } - @if (type_of($varMap) !=map) { - @error 'Map of variables is expected, instead got another type passed: #{type_of($varMap)}'; + @if (type_of($var-map) != map) { + @error 'Map of variables is expected, instead got another type passed: #{type_of($var, ap)}'; } // PROCESS - @if ($css-vars-debug-log or not $css-vars-use-native) { - // Sass or debug - // merge variables and values to the global map (provides no output) - @each $varName, $varValue in $varMap { - $css-vars: _cssVarAssign($varName, $varValue) !global; // store in global variable - } - } - @if ($css-vars-use-native) { // CSS variables // Native CSS: assign CSS custom properties to the global scope @at-root :root { - @each $varName, $varValue in $varMap { - @if (type_of($varValue) ==string) { - #{$varName}: $varValue; // to prevent quotes interpolation + @each $var-name, $var-value in $var-map { + @if (type_of($var-value) == string) { + #{$var-name}: $var-value; // to prevent quotes interpolation } @else { - #{$varName}: #{$varValue}; + #{$var-name}: #{$var-value}; } } } + } @else { + // Sass or debug + // merge variables and values to the global map (provides no output) + @each $var-name, $var-value in $var-map { + $css-vars: css-var-assign($varName, $varValue) !global; // store in global variable + } } } diff --git a/src/sass/settings/colors.scss b/src/sass/settings/colors.scss index 5a2f4e82..c0867b85 100644 --- a/src/sass/settings/colors.scss +++ b/src/sass/settings/colors.scss @@ -2,7 +2,7 @@ // Colors // ========================================================================== -$plyr-color-main: #1aafff !default; +$plyr-color-main: #fff !default; $plyr-color-gunmetal: #2f343d !default; $plyr-color-fiord: #4f5b5f !default; $plyr-color-lynch: #6b7d85 !default; diff --git a/src/sass/settings/controls.scss b/src/sass/settings/controls.scss index 906744b2..0c88163d 100644 --- a/src/sass/settings/controls.scss +++ b/src/sass/settings/controls.scss @@ -9,7 +9,7 @@ $plyr-control-radius: 3px !default; $plyr-video-controls-bg: #000 !default; $plyr-video-control-color: #fff !default; -$plyr-video-control-color-hover: #fff !default; +$plyr-video-control-color-hover: #000 !default; $plyr-video-control-bg-hover: var(--plyr-color-main) !default; $plyr-audio-controls-bg: #fff !default; diff --git a/src/sass/settings/type.scss b/src/sass/settings/type.scss index 79cb57de..e9ee2671 100644 --- a/src/sass/settings/type.scss +++ b/src/sass/settings/type.scss @@ -8,9 +8,9 @@ $plyr-font-size-small: 14px !default; $plyr-font-size-large: 18px !default; $plyr-font-size-xlarge: 21px !default; -$plyr-font-size-time: $plyr-font-size-small !default; +$plyr-font-size-time: var(--plyr-font-size-small) !default; $plyr-font-size-badge: 9px !default; -$plyr-font-size-menu: $plyr-font-size-small !default; +$plyr-font-size-menu: var(--plyr-font-size-small) !default; $plyr-font-weight-regular: 500 !default; $plyr-font-weight-bold: 600 !default; @@ -18,3 +18,19 @@ $plyr-font-weight-bold: 600 !default; $plyr-line-height: 1.7 !default; $plyr-font-smoothing: false !default; + +@include css-vars( + ( + --plyr-font-family: $plyr-font-family, + --plyr-font-size-base: $plyr-font-size-base, + --plyr-font-size-small: $plyr-font-size-small, + --plyr-font-size-large: $plyr-font-size-large, + --plyr-font-size-xlarge: $plyr-font-size-xlarge, + --plyr-font-size-time: $plyr-font-size-time, + --plyr-font-size-badge: $plyr-font-size-badge, + --plyr-font-size-menu: $plyr-font-size-menu, + --plyr-font-weight-regular: $plyr-font-weight-regular, + --plyr-font-weight-bold: $plyr-font-weight-bold, + --plyr-line-height: $plyr-line-height + ) +); |