New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

color-palette-cli

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

color-palette-cli - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

dist/config-init.js

123

dist/color-palette.js

@@ -92,3 +92,3 @@ #!/usr/bin/env node

module.exports = require("chroma-js");
module.exports = require("fs");

@@ -99,3 +99,3 @@ /***/ }),

module.exports = require("fs");
module.exports = require("chroma-js");

@@ -106,2 +106,4 @@ /***/ }),

const fs = __webpack_require__(0);
const inquirer = __webpack_require__(3);

@@ -111,3 +113,3 @@

const chroma = __webpack_require__(0);
const chroma = __webpack_require__(1);

@@ -133,31 +135,10 @@ const dirExists = __webpack_require__(5);

inquirer.prompt([{
name: 'userColor',
type: 'input',
default: '#0F4C81',
message: 'Please enter your primary color. This can be a named, hex, rgb or hsl color.'
}, {
name: 'colorSets',
type: 'checkbox',
message: 'Please select which sets you would like as your secondary colors.',
choices: ['Complimentary', 'Analogous', 'Triadic'],
default: ['Complimentary']
}, {
name: 'pseudo',
type: 'confirm',
message: 'Would you like to generate appropriate pseudo-class colors for hover and active states?',
default: true
}, {
name: 'dir',
type: 'list',
message: 'Please select the directory you would like the scss files placed in.',
choices: listPaths()
}]).then(answers => {
dirExists(answers.dir);
const variablesStream = createStream(`${answers.dir}/_colors_variables.scss`);
const mixinsStream = createStream(`${answers.dir}/_colors_mixins.scss`);
const buildFiles = answers => {
dirExists(answers.directory);
const variablesStream = createStream(`${answers.directory}/_colors_variables.scss`);
const mixinsStream = createStream(`${answers.directory}/_colors_mixins.scss`);
const streams = [variablesStream, mixinsStream]; // Primary
const primaryTextColor = getTextColor(relativeLuminance(...chroma(answers.userColor).rgb()));
const primaryParams = ['primary', answers.userColor, primaryTextColor, answers.pseudo];
const primaryTextColor = getTextColor(relativeLuminance(...chroma(answers.primary).rgb()));
const primaryParams = ['primary', answers.primary, primaryTextColor, answers.pseudo];
variablesStream.write(buildVariables(...primaryParams));

@@ -172,5 +153,5 @@ mixinsStream.write(buildMixins(...primaryParams)); // Secondaries

if (set === 'Complimentary') {
if (set.toLowerCase() === 'complimentary') {
// Complimentary
const complimentaryColor = complimentary(answers.userColor);
const complimentaryColor = complimentary(answers.primary);
const complimentaryTextColor = getTextColor(relativeLuminance(...chroma(complimentaryColor).rgb()));

@@ -180,5 +161,5 @@ const scParams = ['secondary_c', complimentaryColor, complimentaryTextColor, answers.pseudo];

mixinsStream.write(buildMixins(...scParams));
} else if (set === 'Analogous') {
} else if (set.toLowerCase() === 'analogous') {
// Analogous
const analogousSet = analogous(answers.userColor);
const analogousSet = analogous(answers.primary);
const analogousOneTextColor = getTextColor(relativeLuminance(...chroma(analogousSet[0]).rgb()));

@@ -191,5 +172,5 @@ const analogousTwoTextColor = getTextColor(relativeLuminance(...chroma(analogousSet[1]).rgb()));

});
} else if (set === 'Triadic') {
} else if (set.toLowerCase() === 'triadic') {
// Triadic
const triadicSet = triadic(answers.userColor);
const triadicSet = triadic(answers.primary);
const triadicOneTextColor = getTextColor(relativeLuminance(...chroma(triadicSet[0]).rgb()));

@@ -212,11 +193,44 @@ const triadicTwoTextColor = getTextColor(relativeLuminance(...chroma(triadicSet[1]).rgb()));

console.log('\x1b[32m%s\x1b[0m', `Created '_colors_mixins.scss' & '_colors_variables.scss' at '${answers.dir}'.`);
}).catch(error => {
if (error.isTtyError) {
console.log(error.isTtyError);
} else {
console.log(error);
}
});
console.log('\x1b[32m%s\x1b[0m', `Created '_colors_mixins.scss' & '_colors_variables.scss' at '${answers.directory}'.`);
};
if (fs.existsSync('./color-palette.config.js')) {
console.log('\x1b[32m%s\x1b[0m', 'Config file detected.');
const answers = __webpack_require__(15);
buildFiles(answers);
} else {
inquirer.prompt([{
name: 'primary',
type: 'input',
default: '#0F4C81',
message: 'Please enter your primary color. This can be a named, hex, rgb or hsl color.'
}, {
name: 'colorSets',
type: 'checkbox',
message: 'Please select which sets you would like as your secondary colors.',
choices: ['Complimentary', 'Analogous', 'Triadic'],
default: ['Complimentary']
}, {
name: 'pseudo',
type: 'confirm',
message: 'Would you like to generate appropriate pseudo-class colors for hover and active states?',
default: true
}, {
name: 'directory',
type: 'list',
message: 'Please select the directory you would like the scss files placed in.',
choices: listPaths()
}]).then(answers => {
buildFiles(answers);
}).catch(error => {
if (error.isTtyError) {
console.log(error.isTtyError);
} else {
console.log(error);
}
});
}
/***/ }),

@@ -238,3 +252,3 @@ /* 3 */

const fs = __webpack_require__(1);
const fs = __webpack_require__(0);

@@ -257,3 +271,3 @@ const dirExists = dir => {

const fs = __webpack_require__(1);
const fs = __webpack_require__(0);

@@ -270,3 +284,3 @@ const createStream = path => {

const chroma = __webpack_require__(0);
const chroma = __webpack_require__(1);

@@ -344,3 +358,3 @@ const complimentary = color => {

const chroma = __webpack_require__(0);
const chroma = __webpack_require__(1);

@@ -444,3 +458,3 @@ const dedent = __webpack_require__(12);

const chroma = __webpack_require__(0);
const chroma = __webpack_require__(1);

@@ -477,3 +491,14 @@ const {

/***/ }),
/* 15 */
/***/ (function(module, exports) {
module.exports = {
primary: '#0f4c81',
colorSets: ['Complimentary'],
pseudo: true,
directory: './'
};
/***/ })
/******/ ]);
{
"name": "color-palette-cli",
"version": "1.0.3",
"version": "1.1.0",
"main": "dist/color-palette.js",
"bin": {
"color-palette": "dist/color-palette.js"
"color-palette": "dist/color-palette.js",
"color-palette-init": "dist/config-init.js"
},

@@ -8,0 +9,0 @@ "description": "A color palette designer built from a single primary color.",

@@ -29,2 +29,25 @@ # Color Palette CLI

## Config
Color Palette CLI also has support for the use of a local config file to allow quick setup and storable user preferences.
```js
$ npx -p color-palette-cli color-palette-init // Creates a color-palette.config.js file in the route working directory.
```
Once your config file is created, continue by calling the installation command via npx and you'll be all setup.
## Config Setup
Each of the fields in the config file equate to the CLI options above.
```js
module.exports = {
primary: '#0f4c81', //String
colorSets: ['Complimentary'], //String[]
pseudo: true, //Boolean
directory: './' //String
}
```
## Examples

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