File size: 828 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
const _ = require( 'lodash' );
const argv = require( 'yargs' ).argv;
const [ baseName, colorName ] = argv._;
const suffixes = [
'',
'dark',
'light',
'0',
'5',
'10',
'20',
'30',
'40',
'50',
'60',
'70',
'80',
'90',
'100',
];
suffixes.forEach( ( suffix ) => {
const propertyName = _.compact( [ '--color', baseName, suffix ] ).join( '-' );
const variableName = _.compact( [ '--studio', colorName, determineShadeIndex( suffix ) ] ).join(
'-'
);
printEntry( propertyName, variableName );
} );
function determineShadeIndex( suffix ) {
switch ( suffix ) {
case '':
return '50';
case 'dark':
return '70';
case 'light':
return '30';
default:
return String( suffix );
}
}
function printEntry( propertyName, variableName ) {
console.log( `${ propertyName }: var( ${ variableName } );` );
}
|