JavaScript で乱数 Math.random()
使ってカラーコード生成
// RGB
let rgbArray = [...Array(3)].map(i => Math.floor(Math.random() * 256));
let colorCode = 'rgb(' + rgbArray.join(',') + ')';
// Hex
let hex = '#' + Math.random().toString(16).slice(-6);
Go to list of users who liked
More than 1 year has passed since last update.
JavaScript で乱数 Math.random()
使ってカラーコード生成
// RGB
let rgbArray = [...Array(3)].map(i => Math.floor(Math.random() * 256));
let colorCode = 'rgb(' + rgbArray.join(',') + ')';
// Hex
let hex = '#' + Math.random().toString(16).slice(-6);
Register as a new user and use Qiita more conveniently
Go to list of users who liked