Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

antd-theme-generator

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

antd-theme-generator - npm Package Compare versions

Comparing version 1.1.7 to 1.1.8

22

index.js

@@ -57,3 +57,3 @@ const fs = require("fs");

*/
function generateColorMap(content) {
function generateColorMap(content, customColorRegexArray = []) {
return content

@@ -73,5 +73,5 @@ .split("\n")

color = getColor(color, prev);
if (!isValidColor(color)) return prev;
if (!isValidColor(color, customColorRegexArray)) return prev;
prev[varName] = color;
} else if (isValidColor(color)) {
} else if (isValidColor(color, customColorRegexArray)) {
prev[varName] = color;

@@ -211,3 +211,3 @@ }

*/
function isValidColor(color) {
function isValidColor(color, customColorRegexArray = []) {
if (!color || color.match(/px/g)) return false;

@@ -221,5 +221,12 @@ if (color.match(/colorPalette|fade/g)) return true;

}
return /^(rgb|hsl|hsv)a?\((\d+%?(deg|rad|grad|turn)?[,\s]+){2,3}[\s\/]*[\d\.]+%?\)$/i.test(
const isColor = /^(rgb|hsl|hsv)a?\((\d+%?(deg|rad|grad|turn)?[,\s]+){2,3}[\s\/]*[\d\.]+%?\)$/i.test(
color
);
if (isColor) return true;
if (customColorRegexArray.length > 0) {
return customColorRegexArray.reduce((prev, regex) => {
return prev || regex.test(color);
}, false);
}
return false;
}

@@ -264,3 +271,4 @@

cssModules = false,
themeVariables = ['@primary-color']
themeVariables = ['@primary-color'],
customColorRegexArray = []
}) {

@@ -320,3 +328,3 @@ return new Promise((resolve, reject) => {

.then(colorsLess => {
const mappings = Object.assign(generateColorMap(colorsLess), generateColorMap(mainLessFile));
const mappings = Object.assign(generateColorMap(colorsLess, customColorRegexArray), generateColorMap(mainLessFile, customColorRegexArray));
return [mappings, colorsLess];

@@ -323,0 +331,0 @@ })

{
"name": "antd-theme-generator",
"version": "1.1.7",
"version": "1.1.8",
"description": "This a script to generate color specific styles less file and which you can use to change theme dynamically in browser",

@@ -5,0 +5,0 @@ "main": "index.js",

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