顏色隨機生成腳本:randomColor.js

bgn4 9年前發布 | 22K 次閱讀 JavaScript開發 randomColor.js

randomColor.js 是生成隨機顏色的小腳本。

顏色隨機生成腳本:randomColor.js

支持的選項:

  • Hue

  • Luminosity

  • Count

  • Format

代碼示例:

// Returns a hex code for an attractive color
randomColor(); 
// Returns an array of ten green colors
randomColor({
   count: 10,
   hue: 'green'
});
// Returns a hex code for a light blue
randomColor({
   luminosity: 'light',
   hue: 'blue'
});
// Returns a hex code for a 'truly random' color
randomColor({
   luminosity: 'random',
   hue: 'random'
});
// Returns a bright color in RGB
randomColor({
   luminosity: 'bright',
   format: 'rgb' // e.g. 'rgb(225,200,20)'
});

項目主頁:http://www.baiduhome.net/lib/view/home/1430832317648

 本文由用戶 bgn4 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!