//当HTML的data-theme为dark时，样式引用dark
//data-theme为其他值时，就采用组件库的默认样式
//这里我只定义了两套主题方案，想要再多只需在`$themes`里加就行了
//注意一点是，每套配色方案里的key可以自定义但必须一致，不然就会混乱
 
$themes: (
 
elder: (
//字体
font-size0: 24rpx,
font-size1: 28rpx,
font-size2: 32rpx,
font-size3: 36rpx,
font-size4: 40rpx,
font-size5: 44rpx,
font-size6: 48rpx,
font-size7: 52rpx,
font-size8: 56rpx,
font-size9: 60rpx,
font-size10: 64rpx,
font-size11: 68rpx,
font-size12: 72rpx,
font-size13: 76rpx,
font-size14: 80rpx,
font-size15: 84rpx,
font-size16: 88rpx,
font-size17: 92rpx,
font-size18: 96rpx,
font-size19: 100rpx,
buttonWidth1: 160rpx,
buttonWidth: 300rpx,
fontWeight: bold!important,
font_color1: #410311,
font_color2: white,
font_colorLabel:#000000,
letterSpacing:2px,
cardHeight:390rpx,
//背景
background_color1: #3422ff,
background_color2: #f0f2f5,
background_color3: red,
background_color4: #2674e7,
 
//边框
border_color1: #3d414a,
 
),
 
standard: (
//字体
font-size0: 20rpx,
font-size1: 24rpx,
font-size2: 28rpx,
font-size3: 32rpx,
font-size4: 36rpx,
font-size5: 40rpx,
font-size6: 44rpx,
font-size7: 48rpx,
font-size8: 52rpx,
font-size9: 56rpx,
font-size10: 60rpx,
font-size11: 64rpx,
font-size12: 68rpx,
font-size13: 72rpx,
font-size14: 76rpx,
font-size15: 80rpx,
font-size16: 84rpx,
font-size17: 88rpx,
font-size18: 92rpx,
font-size19: 96rpx,

font_color1: #a77439,
font_color2: white,
fontWeight: normal,
font_colorLabel:#9f9c99,
letterSpacing:0px,
buttonWidth1: 140rpx,
buttonWidth: 260rpx,
cardHeight:360rpx,
//背景
background_color1: #1b2531,
background_color2: #283142,
background_color3: #1e6ceb,
background_color4: #323e4e,
 
//边框
border_color1: #3d414a,
 
)
);
$theme-map: null;
//遍历主题map
@mixin themeify {
@each $theme-name, $theme-map in $themes {
//!global 把局部变量强升为全局变量
$theme-map: $theme-map !global;
//判断html的data-theme的属性值  #{}是sass的插值表达式
//& sass嵌套里的父容器标识   @content是混合器插槽，像vue的slot
[data-theme="#{$theme-name}"] & {
@content;
}
}
}
 
//声明一个根据Key获取颜色的function
@function themed($key) {
@return map-get($theme-map, $key);
}

.font1{
		@include themeify{
			font-size: themed('font-size1');
		}
	}
	
.font2{
		@include themeify{
			font-size: themed('font-size2');
		}
	}
.font3{
		@include themeify{
			font-size: themed('font-size3');
		}
	}
.font4{
		@include themeify{
			font-size: themed('font-size4');
		}
	}
.font5{
		@include themeify{
			font-size: themed('font-size5');
		}
	}
.font6{
		@include themeify{
			font-size: themed('font-size6');
		}
	}
.font7{
		@include themeify{
			font-size: themed('font-size7');
		}
	}
.font8{
		@include themeify{
			font-size: themed('font-size8');
		}
	}
.font9{
		@include themeify{
			font-size: themed('font-size9');
		}
	}
.font10{
		@include themeify{
			font-size: themed('font-size10');
		}
	}				
						
			

.font-weight1{
		@include themeify{
			font-size: themed('font-size1');
			font-weight:themed('font-weight1');
			letter-spacing: themed('letterSpacing');
		}
	}
	
.font-weight2{
		@include themeify{
			font-size: themed('font-size2');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight3{
		@include themeify{
			font-size: themed('font-size3');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight4{
		@include themeify{
			font-size: themed('font-size4');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight5{
		@include themeify{
			font-size: themed('font-size5');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight6{
		@include themeify{
			font-size: themed('font-size6');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight7{
		@include themeify{
			font-size: themed('font-size7');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight8{
		@include themeify{
			font-size: themed('font-size8');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight9{
		@include themeify{
			font-size: themed('font-size9');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}
.font-weight10{
		@include themeify{
			font-size: themed('font-size10');
			font-weight:themed('fontWeight');
			letter-spacing: themed('letterSpacing');
		}
	}				
			 