npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wb-color

v1.2.2

Published

获取随机颜色,控制台打印有颜色的文本

Downloads

8

Readme

安装

npm install wb-color

引入

import wbColor from 'wb-color';

获取随机颜色

wbColor.getColor();//返回单个字符串颜色'#66aab1'

wbColor.getColor(3);//返回单个字符串是三个颜色'#e121e1,#23a121,#43bb32'

wbColor.getColor('3');//返回单个字符串是三个颜色'#e121e1,#23a121,#43bb32'

wbColor.getColor('Arrary',3);//返回数组['#e121e1','#23a121','#43bb32'],参数不区分大小写

wbColor.getColor('Arr','3');//返回数组['#e121e1','#23a121','#43bb32'],,参数不区分大小写

控制台打印

//控制台打印带有特殊样式的文本 string:1 ==> Hello World!,分别表示类型,次数,分隔符,以及打印的数据
wbColor.consoleColor('Hello World!');

//控制台打印自定义样式的文本 string:2 ==> Hello World! 
wbColor.consoleColor('Hello World!','color:red;font-size:16px');

//控制台打印自定义样式的文本并且自定义设置输出的次数 string:3 ==> Hello World! 
wbColor.consoleColor('Hello World!','color:red;font-size:16px',3);

//控制台打印参数还可以设置一个对象,输出颜色红色,字体大小16px的信息 string:1 ==> Hello World!
wbColor.consoleColor('Hello World!',{style:'color:red;font-size:16px'})

//控制台打印参数设置的对象可以有更多的选择,样式属性可以自定义添加,会自动解析,详细参数如下:
/*
    {
    	//样式参数
        color:'#43bb88',//设置颜色
        'font-size':'20px',//设置字体大小
        'font-weight':'bold',//设置字体加粗
        'text-decoration':'underline',//设置字体下划线
        ......
        
        //功能参数
        type:true,//选择打印首输出是类型或者是值,默认true,输出是类型
        identify : '==>',//设置分隔符,默认是'==>'
        startNumber:false,//设置次数,默认false从1开始,每次累计加一
        msg:false,//设置msg为true时表示打印首输出提示自定义,默认false
        clear:false//设置为true时自动清除控制台所有输出记录,然后再输出本次记录,默认false
    }
*/
wbColor.consoleColor('Hello World!',{color:'red',msg:'你好',startNumber:10,identify:'--'})

全局注入控制台打印

window.wb = wbColor.consoleColor;

任意地方使用wb('打印内容')即可

wb('Hello World!')//控制台特有样式输出 string:1 ==> Hello World!