Download wp-calypso/bin/generate-style-variants.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 828 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/bin/generate-style-variants.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/bin/generate-style-variants.js
-
curl -L -o generate-style-variants.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/bin/generate-style-variants.js
828 Bytes
| 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 } );` ); | |
| } | |