@txdfe/at-colors
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -8,8 +8,8 @@ "use strict"; | ||
var hueStep = 2; // 色相阶梯 | ||
var saturationStep = 16; // 饱和度阶梯,浅色部分 | ||
var saturationStep2 = 5; // 饱和度阶梯,深色部分 | ||
var brightnessStep1 = 5; // 亮度阶梯,浅色部分 | ||
var brightnessStep2 = 15; // 亮度阶梯,深色部分 | ||
var lightColorCount = 5; // 浅色数量,主色上 | ||
var darkColorCount = 4; // 深色数量,主色下 | ||
var lightColorCount = 3; // 浅色数量,主色上 | ||
var darkColorCount = 3; // 深色数量,主色下 | ||
var saturationStep; // 饱和度阶梯,浅色部分 | ||
var saturationStep2; // 饱和度阶梯,深色部分 | ||
var brightnessStep1; // 亮度阶梯,浅色部分 | ||
var brightnessStep2; // 亮度阶梯,深色部分 | ||
// 暗色主题颜色映射关系表 | ||
@@ -45,2 +45,53 @@ var darkColorMap = [ | ||
} | ||
function getStepsValue(hue) { | ||
// 红色 | ||
if (hue >= 0 && hue < 24) { | ||
saturationStep = 27; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 13; | ||
brightnessStep2 = 15; | ||
} | ||
// 黄色 | ||
if (hue >= 24 && hue < 56) { | ||
saturationStep = 34; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 13; | ||
brightnessStep2 = 15; | ||
} | ||
// 绿色 | ||
if (hue >= 56 && hue < 170) { | ||
saturationStep = 20; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 10; | ||
brightnessStep2 = 15; | ||
} | ||
// 浅蓝 | ||
if (hue >= 170 && hue < 190) { | ||
saturationStep = 32; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 10; | ||
brightnessStep2 = 15; | ||
} | ||
// 深蓝 | ||
if (hue >= 190 && hue < 250) { | ||
saturationStep = 32; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 15; | ||
brightnessStep2 = 15; | ||
} | ||
// 紫色 | ||
if (hue >= 250 && hue < 300) { | ||
saturationStep = 40; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 15; | ||
brightnessStep2 = 25; | ||
} | ||
// 粉色 | ||
if (hue >= 300 && hue < 360) { | ||
saturationStep = 22; | ||
saturationStep2 = 5; | ||
brightnessStep1 = 13; | ||
brightnessStep2 = 15; | ||
} | ||
} | ||
function getSaturation(hsv, i, light) { | ||
@@ -84,2 +135,4 @@ // grey color don't change saturation | ||
var pColor = tinycolor2_1.default(color); | ||
var pColorHue = pColor.toHsv().h; | ||
getStepsValue(pColorHue); | ||
for (var i = lightColorCount; i > 0; i -= 1) { | ||
@@ -86,0 +139,0 @@ var hsv = pColor.toHsv(); |
{ | ||
"name": "@txdfe/at-colors", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Color palettes generator of AT", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6204
182