purgetss 6.2.31 → 6.2.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/purgetss CHANGED
@@ -70,14 +70,15 @@ program
70
70
  .argument('[hexcode]', 'The base hexcode value')
71
71
  .argument('[name]', 'Name of the color')
72
72
  .option('-n, --name', 'Specify the name of the color')
73
- .option('-q, --quotes', `Keep double quotes in the ${chalk.yellow('config.js')} file`)
73
+ .option('-q, --quotes', `Keep double quotes in ${chalk.yellow('config.js')}`)
74
74
  .option('-r, --random', 'Generate shades from a random color')
75
+ .option('-o, --override', `Place new shades in ${chalk.yellow('theme.colors')} to override default colors`)
75
76
  .option('-s, --single', 'Generate a single color definition')
76
- .option('-t, --tailwind', `Log the generated shades with a ${chalk.yellow('tailwind.config.js')} compatible structure`)
77
- .option('-l, --log', 'Log the generated shades instead of saving them')
78
- .option('-j, --json', `Log a JSON compatible structure, which can be used in ${chalk.yellow('app/config.json')}`)
79
- .description('Color shades generator from a given hexcolor')
80
- .help('Generate color shades from a given hexcolor to use in your project')
77
+ .option('-l, --log', 'Log shades instead of saving them')
78
+ .option('-j, --json', `Log shades in ${chalk.yellow('app/config.json')} format`)
79
+ .option('-t, --tailwind', `Log shades in ${chalk.yellow('tailwind.config.js')} format`)
80
+ .description(`Generate color shades for ${chalk.yellow('config.js')} from a given hexcolor`)
81
+ .help(`Generate color shades from a hexcolor for your project. By default, the new shades are placed in ${chalk.yellow('theme.extend.colors')}`)
81
82
  .action((args, options, logger) => {
82
83
  purgetss.shades(args, options)
83
84
  })
@@ -129,7 +130,7 @@ program
129
130
  program
130
131
  .command('build-fonts')
131
132
  .alias('bf')
132
- .description(`Generate a ${chalk.yellow('fonts.tss')} file based on the font and css files located in ${chalk.yellow('./purgetss/fonts')}`)
133
+ .description(`Generate ${chalk.yellow('fonts.tss')} from font and CSS files in ${chalk.yellow('./purgetss/fonts')}`)
133
134
  .help(`Generate a ${chalk.yellow('./purgetss/styles/fonts.tss')} file based on the font and css files located in ${chalk.yellow('./purgetss/fonts')} folder`)
134
135
  .option('-m, --module', `To also generate a CommonJS module in ${chalk.yellow('./app/lib/')} folder called ${chalk.yellow('purgetss-fonts.js')}`)
135
136
  .action((args, options, logger) => {
package/index.js CHANGED
@@ -415,14 +415,8 @@ exports.create = create
415
415
  // ! Command: shades
416
416
  function shades(args, options) {
417
417
  const chroma = require('chroma-js')
418
+ const referenceColorFamilies = require('./lib/color-shades/tailwindColors')
418
419
  const generateColorShades = require('./lib/color-shades/generateColorShades')
419
- const referenceColorFamilies = require('./lib/color-shades/tailwindColors').filter((item) => {
420
- return item.name !== 'warmGray' &&
421
- item.name !== 'trueGray' &&
422
- item.name !== 'gray' &&
423
- item.name !== 'coolGray' &&
424
- item.name !== 'blueGray'
425
- })
426
420
 
427
421
  const colorFamily = (options.random || !args.hexcode) ? generateColorShades(chroma.random(), referenceColorFamilies) : generateColorShades(args.hexcode, referenceColorFamilies)
428
422
 
@@ -435,8 +429,24 @@ function shades(args, options) {
435
429
 
436
430
  const silent = options.tailwind || options.json || options.log
437
431
  if (alloyProject(silent) && !silent) {
438
- if (!configFile.theme.extend.colors) configFile.theme.extend.colors = {}
439
- configFile.theme.extend.colors[colorObject.name] = colorObject.shades
432
+ if (options.override) {
433
+ if (!configFile.theme.colors) configFile.theme.colors = {}
434
+ configFile.theme.colors[colorObject.name] = colorObject.shades
435
+
436
+ if (configFile.theme.extend.colors) {
437
+ if (configFile.theme.extend.colors[colorObject.name]) delete configFile.theme.extend.colors[colorObject.name]
438
+ if (Object.keys(configFile.theme.extend.colors).length === 0) delete configFile.theme.extend.colors
439
+ }
440
+ } else {
441
+ if (!configFile.theme.extend.colors) configFile.theme.extend.colors = {}
442
+ configFile.theme.extend.colors[colorObject.name] = colorObject.shades
443
+
444
+ if (configFile.theme.colors) {
445
+ if (configFile.theme.colors[colorObject.name]) delete configFile.theme.colors[colorObject.name]
446
+ if (Object.keys(configFile.theme.colors).length === 0) delete configFile.theme.colors
447
+ }
448
+ }
449
+
440
450
  fs.writeFileSync(projectsConfigJS, 'module.exports = ' + cleanDoubleQuotes(configFile, options), 'utf8', err => { throw err })
441
451
  checkIfColorModule()
442
452
  logger.info(`${chalk.hex(colorFamily.hexcode).bold(`“${colorFamily.name}”`)} (${chalk.bgHex(colorFamily.hexcode)(colorFamily.hexcode)}) saved in`, chalk.yellow('config.js'))
@@ -1,84 +1,4 @@
1
1
  module.exports = [
2
- {
3
- name: 'slate',
4
- shades: [
5
- { number: '50', hexcode: '#f8fafc' },
6
- { number: '100', hexcode: '#f1f5f9' },
7
- { number: '200', hexcode: '#e2e8f0' },
8
- { number: '300', hexcode: '#cbd5e1' },
9
- { number: '400', hexcode: '#94a3b8' },
10
- { number: '500', hexcode: '#64748b' },
11
- { number: '600', hexcode: '#475569' },
12
- { number: '700', hexcode: '#334155' },
13
- { number: '800', hexcode: '#1e293b' },
14
- { number: '900', hexcode: '#0f172a' },
15
- { number: '950', hexcode: '#020617' }
16
- ]
17
- },
18
- {
19
- name: 'gray',
20
- shades: [
21
- { number: '50', hexcode: '#f9fafb' },
22
- { number: '100', hexcode: '#f3f4f6' },
23
- { number: '200', hexcode: '#e5e7eb' },
24
- { number: '300', hexcode: '#d1d5db' },
25
- { number: '400', hexcode: '#9ca3af' },
26
- { number: '500', hexcode: '#6b7280' },
27
- { number: '600', hexcode: '#4b5563' },
28
- { number: '700', hexcode: '#374151' },
29
- { number: '800', hexcode: '#1f2937' },
30
- { number: '900', hexcode: '#111827' },
31
- { number: '950', hexcode: '#030712' }
32
- ]
33
- },
34
- {
35
- name: 'zinc',
36
- shades: [
37
- { number: '50', hexcode: '#fafafa' },
38
- { number: '100', hexcode: '#f4f4f5' },
39
- { number: '200', hexcode: '#e4e4e7' },
40
- { number: '300', hexcode: '#d4d4d8' },
41
- { number: '400', hexcode: '#a1a1aa' },
42
- { number: '500', hexcode: '#71717a' },
43
- { number: '600', hexcode: '#52525b' },
44
- { number: '700', hexcode: '#3f3f46' },
45
- { number: '800', hexcode: '#27272a' },
46
- { number: '900', hexcode: '#18181b' },
47
- { number: '950', hexcode: '#09090b' }
48
- ]
49
- },
50
- {
51
- name: 'neutral',
52
- shades: [
53
- { number: '50', hexcode: '#fafafa' },
54
- { number: '100', hexcode: '#f5f5f5' },
55
- { number: '200', hexcode: '#e5e5e5' },
56
- { number: '300', hexcode: '#d4d4d4' },
57
- { number: '400', hexcode: '#a3a3a3' },
58
- { number: '500', hexcode: '#737373' },
59
- { number: '600', hexcode: '#525252' },
60
- { number: '700', hexcode: '#404040' },
61
- { number: '800', hexcode: '#262626' },
62
- { number: '900', hexcode: '#171717' },
63
- { number: '950', hexcode: '#0a0a0a' }
64
- ]
65
- },
66
- {
67
- name: 'stone',
68
- shades: [
69
- { number: '50', hexcode: '#fafaf9' },
70
- { number: '100', hexcode: '#f5f5f4' },
71
- { number: '200', hexcode: '#e7e5e4' },
72
- { number: '300', hexcode: '#d6d3d1' },
73
- { number: '400', hexcode: '#a8a29e' },
74
- { number: '500', hexcode: '#78716c' },
75
- { number: '600', hexcode: '#57534e' },
76
- { number: '700', hexcode: '#44403c' },
77
- { number: '800', hexcode: '#292524' },
78
- { number: '900', hexcode: '#1c1917' },
79
- { number: '950', hexcode: '#0c0a09' }
80
- ]
81
- },
82
2
  {
83
3
  name: 'red',
84
4
  shades: [
@@ -366,69 +286,5 @@ module.exports = [
366
286
  { number: '900', hexcode: '#0c4a6e' },
367
287
  { number: '950', hexcode: '#082f49' }
368
288
  ]
369
- },
370
- {
371
- name: 'warmGray',
372
- shades: [
373
- { number: '50', hexcode: '#fafaf9' },
374
- { number: '100', hexcode: '#f5f5f4' },
375
- { number: '200', hexcode: '#e7e5e4' },
376
- { number: '300', hexcode: '#d6d3d1' },
377
- { number: '400', hexcode: '#a8a29e' },
378
- { number: '500', hexcode: '#78716c' },
379
- { number: '600', hexcode: '#57534e' },
380
- { number: '700', hexcode: '#44403c' },
381
- { number: '800', hexcode: '#292524' },
382
- { number: '900', hexcode: '#1c1917' },
383
- { number: '950', hexcode: '#0c0a09' }
384
- ]
385
- },
386
- {
387
- name: 'trueGray',
388
- shades: [
389
- { number: '50', hexcode: '#fafafa' },
390
- { number: '100', hexcode: '#f5f5f5' },
391
- { number: '200', hexcode: '#e5e5e5' },
392
- { number: '300', hexcode: '#d4d4d4' },
393
- { number: '400', hexcode: '#a3a3a3' },
394
- { number: '500', hexcode: '#737373' },
395
- { number: '600', hexcode: '#525252' },
396
- { number: '700', hexcode: '#404040' },
397
- { number: '800', hexcode: '#262626' },
398
- { number: '900', hexcode: '#171717' },
399
- { number: '950', hexcode: '#0a0a0a' }
400
- ]
401
- },
402
- {
403
- name: 'coolGray',
404
- shades: [
405
- { number: '50', hexcode: '#f9fafb' },
406
- { number: '100', hexcode: '#f3f4f6' },
407
- { number: '200', hexcode: '#e5e7eb' },
408
- { number: '300', hexcode: '#d1d5db' },
409
- { number: '400', hexcode: '#9ca3af' },
410
- { number: '500', hexcode: '#6b7280' },
411
- { number: '600', hexcode: '#4b5563' },
412
- { number: '700', hexcode: '#374151' },
413
- { number: '800', hexcode: '#1f2937' },
414
- { number: '900', hexcode: '#111827' },
415
- { number: '950', hexcode: '#030712' }
416
- ]
417
- },
418
- {
419
- name: 'blueGray',
420
- shades: [
421
- { number: '50', hexcode: '#f8fafc' },
422
- { number: '100', hexcode: '#f1f5f9' },
423
- { number: '200', hexcode: '#e2e8f0' },
424
- { number: '300', hexcode: '#cbd5e1' },
425
- { number: '400', hexcode: '#94a3b8' },
426
- { number: '500', hexcode: '#64748b' },
427
- { number: '600', hexcode: '#475569' },
428
- { number: '700', hexcode: '#334155' },
429
- { number: '800', hexcode: '#1e293b' },
430
- { number: '900', hexcode: '#0f172a' },
431
- { number: '950', hexcode: '#020617' }
432
- ]
433
289
  }
434
290
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "purgetss",
3
- "version": "6.2.31",
3
+ "version": "6.2.33",
4
4
  "description": "A package that simplifies mobile app creation for Titanium developers.",
5
5
  "main": "index.js",
6
6
  "bin": {