name-the-color-stylus
v1.0.0
Published
Creates name for colors by Chirag Mehta's ntc.js and turn it into class name.
Downloads
2
Readme
name-the-color-stylus
Creates names for colors by Chirag Mehta's ntc.js and turn them into class names.
Installation
$ npm install name-the-color-stylus
With JavaScript
var nameTheColor = require('name-the-color-stylus'),
stylus = require('stylus');
function compile(str) {
return stylus(str)
.use(nameTheColor());
}
With Gulp
var nameTheColor = require('name-the-color-stylus'),
stylus = require('gulp-stylus');
gulp.task('stylus', function(){
gulp.src('./your_stylus_file.styl')
.pipe(stylus({ use: nameTheColor()}))
.pipe(gulp.dest('./dist'));
});
Stylus Functions
name
Returns name of the color
name(#2574FF) // 'Dodger Blue'
class-name
Returns class name of the color
class-name(#2574FF) // 'dodger-blue'
hue-name
Returns approximate hue name of the color
hue-name(#2574FF) // 'Blue'
name-that-color
Returns the color's all information as a list (ntc.name() method in ntc.js)
name-that-color(#2574FF) // '#1E90FF' 'Dodger Blue' '#0000FF' 'Blue' false