@@ -741,12 +741,28 @@ var theme = (function(){
741741}
742742} ) ;
743743} ,
744- shades : function ( rgb ) {
744+ shades : function ( override ) {
745+ var options = {
746+ rgb : null ,
747+ contrastNegative : null ,
748+ contrastPositive : null
749+ } ;
750+ if ( override ) {
751+ options = helper . applyOptions ( options , override ) ;
752+ } ;
753+
745754var shadeMax = 10 ;
746755var shadeMin = 1 ;
747- var contrastNeg = state . get . current ( ) . theme . color . contrast . dark ;
748- var contrastPos = state . get . current ( ) . theme . color . contrast . light ;
749- var hsl = helper . convertColor . rgb . hsl ( rgb ) ;
756+
757+ if ( options . contrastNegative == null || ! options . contrastNegative ) {
758+ options . contrastNegative = state . get . default ( ) . theme . color . contrast . dark ;
759+ } ;
760+ if ( options . contrastPositive == null || ! options . contrastPositive ) {
761+ options . contrastPositive = state . get . default ( ) . theme . color . contrast . light ;
762+ } ;
763+
764+ var hsl = helper . convertColor . rgb . hsl ( options . rgb ) ;
765+
750766var validateRGBNumber = function ( rgb ) {
751767for ( var key in rgb ) {
752768if ( rgb [ key ] < 0 ) {
@@ -764,11 +780,12 @@ var theme = (function(){
764780positive : { }
765781} ;
766782
783+ // set light theme shades
767784for ( var i = shadeMax ; i >= shadeMin ; i -- ) {
768785var rgb = helper . convertColor . hsl . rgb ( {
769786h : hsl . h ,
770787s : hsl . s ,
771- l : hsl . l - ( contrastNeg * i )
788+ l : hsl . l - ( options . contrastNegative * i )
772789} ) ;
773790shadeColors . negative [ i ] = validateRGBNumber ( rgb ) ;
774791} ;
@@ -778,15 +795,19 @@ var theme = (function(){
778795var rgb = helper . convertColor . hsl . rgb ( {
779796h : hsl . h ,
780797s : hsl . s ,
781- l : hsl . l + ( contrastPos * i )
798+ l : hsl . l + ( options . contrastPositive * i )
782799} ) ;
783800shadeColors . positive [ i ] = validateRGBNumber ( rgb ) ;
784801} ;
785802
786803return shadeColors ;
787804} ,
788805generated : function ( ) {
789- var shades = mod . color . shades ( state . get . current ( ) . theme . color . rgb ) ;
806+ var shades = mod . color . shades ( {
807+ rgb : state . get . current ( ) . theme . color . rgb ,
808+ contrastNegative : state . get . current ( ) . theme . color . contrast . dark ,
809+ contrastPositive : state . get . current ( ) . theme . color . contrast . light
810+ } ) ;
790811helper . setObject ( {
791812object : state . get . current ( ) ,
792813path : "theme.color.generated.negative" ,
0 commit comments