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.0.0 to 1.0.1

20

index.js

@@ -7,2 +7,7 @@ const fs = require("fs");

const bundle = require("less-bundle-promise");
function randomColor() {
return '#' + (Math.random() * 0xFFFFFF << 0).toString(16);
}
/*

@@ -55,3 +60,2 @@ Recursively get the color code assigned to a variable e.g.

let [, varName, color] = matches;
// console.log(varName, color);
if (color && color.startsWith("@")) {

@@ -64,3 +68,2 @@ color = getColor(color, prev);

}
// console.log(varName, color);
return prev;

@@ -260,7 +263,8 @@ } catch (e) {

];
bundle({
return bundle({
src: varFile
})
.then(colorsLess => {
const mappings = generateColorMap(colorsLess);
const mappings = Object.assign(generateColorMap(colorsLess), generateColorMap(mainLessFile));
return [mappings, colorsLess];

@@ -312,3 +316,3 @@ })

const color = mappings[varName];
css = css.replace(new RegExp(`${color}`, "g"), `${varName}`);
css = css.replace(new RegExp(`${color}`, "g"), varName);
});

@@ -320,6 +324,3 @@ if (themeVars.includes("@primary-color")) {

let color = mappings[varName];
css = css.replace(
new RegExp(`${themeCompiledVars[varName]}`, "g"),
`${color}`
);
css = css.replace(new RegExp(`${themeCompiledVars[varName]}`, "g"), color);
});

@@ -352,3 +353,4 @@ }

getLessVars,
randomColor,
renderLessContent: render
};
{
"name": "antd-theme-generator",
"version": "1.0.0",
"version": "1.0.1",
"description":

@@ -5,0 +5,0 @@ "This a script to generate color specific styles less file and which you can use to change theme dynamically in browser",

@@ -27,3 +27,3 @@ # antd-theme-generator

```
## Note: include all color variables in `varFile` that you want to change dynamically and assign them unique color codes.
Add following lines in your main html file

@@ -30,0 +30,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