From e14776f52e75f7b28ea2ae0fe922f2f0f0b0c650 Mon Sep 17 00:00:00 2001 From: Kevin Ross Date: Wed, 4 Nov 2015 17:36:36 -0600 Subject: [PATCH] sass conversion cleanup/removal of commented code --- sass/_mixins-fullpalette.scss | 5 +++-- sass/_mixins-shared.scss | 29 +---------------------------- sass/_mixins-utilities.scss | 29 +++++++++++++++++++++++++++++ sass/_mixins.scss | 19 ------------------- 4 files changed, 33 insertions(+), 49 deletions(-) create mode 100644 sass/_mixins-utilities.scss diff --git a/sass/_mixins-fullpalette.scss b/sass/_mixins-fullpalette.scss index 09aa247c..b5c0f79f 100644 --- a/sass/_mixins-fullpalette.scss +++ b/sass/_mixins-fullpalette.scss @@ -16,10 +16,11 @@ )); // FIXME: these colors are defined in _colors.scss. Since there is no way to access a variable as a string - // FIXME: in sass, this needs to be changed to get a permutation as an actual variable. + // FIXME: in sass, this needs to be changed to get a permutation as an actual variable object. // FIXME: http://krasimirtsonev.com/blog/article/SASS-interpolation-in-a-name-of-variable-nest-variables-within-variables - // FIXME: this shows a valid approach and adds a color function: https://github.com/darrenkopp/libsass-net/issues/12 + // FIXME: The following shows a valid approach and adds a color lookup function from a map, but would require changes in the less files: + // FIXME: https://github.com/darrenkopp/libsass-net/issues/12 @include generic-variations-color($args-variation-color) } } diff --git a/sass/_mixins-shared.scss b/sass/_mixins-shared.scss index 2a931422..eccfc675 100644 --- a/sass/_mixins-shared.scss +++ b/sass/_mixins-shared.scss @@ -1,33 +1,6 @@ // This file is NOT automatically converted and must be manually merged -// contrast-color and brightness borrowed from compass -// Copyright (c) 2009-2014 Christopher M. Eppstein -// Complies with license: https://github.com/Compass/compass/blob/stable/LICENSE.markdown -@function contrast-color($color, $dark: $contrasted-dark-default, $light: $contrasted-light-default, $threshold: null) { - @if $threshold { - // Deprecated in Compass 0.13 - @warn "The $threshold argment to contrast-color is no longer needed and will be removed in the next release."; - } - @if $color == null { - @return null; - } - @else { - $color-brightness: brightness($color); - $dark-text-brightness: brightness($dark); - $light-text-brightness: brightness($light); - @return if(abs($color-brightness - $light-text-brightness) > abs($color-brightness - $dark-text-brightness), $light, $dark); - } -} - -@function brightness($color) { - @if type-of($color) == color { - @return (red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114) / 255 * 100%; - } - @else { - @return unquote("brightness(#{$color})"); - } -} - +@import "mixins-utilities"; // variations(unquote(""), background-color, #FFF); @mixin variations($extra, $material-param-1, $default) { diff --git a/sass/_mixins-utilities.scss b/sass/_mixins-utilities.scss new file mode 100644 index 00000000..233c34d7 --- /dev/null +++ b/sass/_mixins-utilities.scss @@ -0,0 +1,29 @@ +// This file is here to emulate the less #contrast function + +// contrast-color and brightness borrowed from compass +// Copyright (c) 2009-2014 Christopher M. Eppstein +// Complies with license: https://github.com/Compass/compass/blob/stable/LICENSE.markdown +@function contrast-color($color, $dark: $contrasted-dark-default, $light: $contrasted-light-default, $threshold: null) { + @if $threshold { + // Deprecated in Compass 0.13 + @warn "The $threshold argment to contrast-color is no longer needed and will be removed in the next release."; + } + @if $color == null { + @return null; + } + @else { + $color-brightness: brightness($color); + $dark-text-brightness: brightness($dark); + $light-text-brightness: brightness($light); + @return if(abs($color-brightness - $light-text-brightness) > abs($color-brightness - $dark-text-brightness), $light, $dark); + } +} + +@function brightness($color) { + @if type-of($color) == color { + @return (red($color) * 0.299 + green($color) * 0.587 + blue($color) * 0.114) / 255 * 100%; + } + @else { + @return unquote("brightness(#{$color})"); + } +} diff --git a/sass/_mixins.scss b/sass/_mixins.scss index 856380a1..d8b50dfc 100644 --- a/sass/_mixins.scss +++ b/sass/_mixins.scss @@ -3,8 +3,6 @@ @mixin generic-variations-colors($args) { - //$material-color-names: $red $pink $purple $deep-purple $indigo $blue $light-blue $cyan $teal $green $light-green $lime $yellow $amber $orange $deep-orange $brown $grey $blue-grey; - $material-colors: ( "red": $red, "pink": $pink, @@ -37,24 +35,7 @@ @include generic-variations-color($args-variation-color) } - - //@each $material-color-name in $material-color-names { - // //// given a color build multiples depths - // //$material-color-numbers: "" "-50" "-100" "-200" "-300" "-400" "-500" "-600" "-700" "-800" "-900" "-A100" "-A200" "-A400" "-A700"; - // //@each $material-color-number in $material-color-numbers { - // // @include generic-variations-color($mixin-name, $extra, $default, $contrast-factor, $material-color-name, $material-color-number) - // //} - // - // // build a single depth color palette - // $args-variation-color: map-merge($args, ( - // material-color-name: $material-color-name, - // material-color-number: "" - // )); - // - // @include generic-variations-color($args-variation-color) - //} } - // http://hugogiraudel.com/2014/01/27/casting-types-in-sass/ // https://github.com/HugoGiraudel/SassyJSON/blob/master/stylesheets/decode/helpers/color/_color.scss