Socket
Socket
Sign inDemoInstall

ant-design-palettes

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ant-design-palettes - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

index.test.js

@@ -1,2 +0,2 @@

import { generate, presetPalettes } from './';
import { generate, presetPalettes } from './src';

@@ -14,3 +14,3 @@ const blueColors = [

'#002766',
];
].map(color => color.toLowerCase());

@@ -17,0 +17,0 @@ test('Generate palettes from a given color', () => {

@@ -8,5 +8,5 @@ 'use strict';

var _color = require('color');
var _tinycolor = require('tinycolor2');
var _color2 = _interopRequireDefault(_color);
var _tinycolor2 = _interopRequireDefault(_tinycolor);

@@ -26,6 +26,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// 根据色相不同,色相转向不同
if (hsv.color[0] >= 60 && hsv.color[0] <= 240) {
hue = light ? hsv.color[0] - hueStep * i : hsv.color[0] + hueStep * i;
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - hueStep * i : Math.round(hsv.h) + hueStep * i;
} else {
hue = light ? hsv.color[0] + hueStep * i : hsv.color[0] - hueStep * i;
hue = light ? Math.round(hsv.h) + hueStep * i : Math.round(hsv.h) - hueStep * i;
}

@@ -43,7 +43,7 @@ if (hue < 0) {

if (light) {
saturation = hsv.color[1] - saturationStep * i;
saturation = Math.round(hsv.s * 100) - saturationStep * i;
} else if (i === darkColorCount) {
saturation = hsv.color[1] + saturationStep;
saturation = Math.round(hsv.s * 100) + saturationStep;
} else {
saturation = hsv.color[1] + saturationStep2 * i;
saturation = Math.round(hsv.s * 100) + saturationStep2 * i;
}

@@ -66,5 +66,5 @@ // 边界值修正

if (light) {
return hsv.color[2] + brightnessStep1 * i;
return Math.round(hsv.v * 100) + brightnessStep1 * i;
}
return hsv.color[2] - brightnessStep2 * i;
return Math.round(hsv.v * 100) - brightnessStep2 * i;
}

@@ -74,20 +74,20 @@

var patterns = [];
var pColor = (0, _color2.default)(color);
var pColor = (0, _tinycolor2.default)(color);
for (var i = lightColorCount; i > 0; i -= 1) {
var hsv = pColor.hsv().round();
var colorString = (0, _color2.default)({
var hsv = pColor.toHsv();
var colorString = (0, _tinycolor2.default)({
h: getHue(hsv, i, true),
s: getSaturation(hsv, i, true),
v: getValue(hsv, i, true)
}).hex();
}).toHexString();
patterns.push(colorString);
}
patterns.push(pColor.hex());
patterns.push(pColor.toHexString());
for (var _i = 1; _i <= darkColorCount; _i += 1) {
var _hsv = pColor.hsv().round();
var _colorString = (0, _color2.default)({
var _hsv = pColor.toHsv();
var _colorString = (0, _tinycolor2.default)({
h: getHue(_hsv, _i),
s: getSaturation(_hsv, _i),
v: getValue(_hsv, _i)
}).hex();
}).toHexString();
patterns.push(_colorString);

@@ -94,0 +94,0 @@ }

{
"name": "ant-design-palettes",
"version": "1.0.0",
"version": "1.1.0",
"description": "Color palettes calculator of Ant Design",
"main": "lib/index.js",
"module": "src/index.js",
"module": "es/index.js",
"repository": {

@@ -14,4 +14,2 @@ "type": "git",

},
"main": "lib/index.js",
"module": "es/index.js",
"scripts": {

@@ -25,3 +23,3 @@ "compile": "babel src --out-dir lib",

"dependencies": {
"color": "^3.0.0"
"tinycolor2": "^1.4.1"
},

@@ -28,0 +26,0 @@ "devDependencies": {

@@ -1,2 +0,2 @@

import Color from 'color';
import tinycolor from 'tinycolor2';

@@ -14,6 +14,6 @@ const hueStep = 2; // 色相阶梯

// 根据色相不同,色相转向不同
if (hsv.color[0] >= 60 && hsv.color[0] <= 240) {
hue = light ? hsv.color[0] - (hueStep * i) : hsv.color[0] + (hueStep * i);
if (Math.round(hsv.h) >= 60 && Math.round(hsv.h) <= 240) {
hue = light ? Math.round(hsv.h) - (hueStep * i) : Math.round(hsv.h) + (hueStep * i);
} else {
hue = light ? hsv.color[0] + (hueStep * i) : hsv.color[0] - (hueStep * i);
hue = light ? Math.round(hsv.h) + (hueStep * i) : Math.round(hsv.h) - (hueStep * i);
}

@@ -31,7 +31,7 @@ if (hue < 0) {

if (light) {
saturation = hsv.color[1] - (saturationStep * i);
saturation = Math.round(hsv.s * 100) - (saturationStep * i);
} else if (i === darkColorCount) {
saturation = hsv.color[1] + (saturationStep);
saturation = Math.round(hsv.s * 100) + (saturationStep);
} else {
saturation = hsv.color[1] + (saturationStep2 * i);
saturation = Math.round(hsv.s * 100) + (saturationStep2 * i);
}

@@ -54,5 +54,5 @@ // 边界值修正

if (light) {
return hsv.color[2] + (brightnessStep1 * i);
return Math.round(hsv.v * 100) + (brightnessStep1 * i);
}
return hsv.color[2] - (brightnessStep2 * i);
return Math.round(hsv.v * 100) - (brightnessStep2 * i);
}

@@ -62,20 +62,20 @@

const patterns = [];
const pColor = Color(color);
const pColor = tinycolor(color);
for (let i = lightColorCount; i > 0; i -= 1) {
const hsv = pColor.hsv().round();
const colorString = Color({
const hsv = pColor.toHsv();
const colorString = tinycolor({
h: getHue(hsv, i, true),
s: getSaturation(hsv, i, true),
v: getValue(hsv, i, true),
}).hex();
}).toHexString();
patterns.push(colorString);
}
patterns.push(pColor.hex());
patterns.push(pColor.toHexString());
for (let i = 1; i <= darkColorCount; i += 1) {
const hsv = pColor.hsv().round();
const colorString = Color({
const hsv = pColor.toHsv();
const colorString = tinycolor({
h: getHue(hsv, i),
s: getSaturation(hsv, i),
v: getValue(hsv, i),
}).hex();
}).toHexString();
patterns.push(colorString);

@@ -82,0 +82,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc