mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
Merge pull request #1136 from akiyamaneko/RGB_COLOR
RGB随机颜色的上限值不对且API重复
This commit is contained in:
commit
f3667dd110
@ -61,6 +61,12 @@ public class ImgUtil {
|
||||
public static final String IMAGE_TYPE_BMP = "bmp";// 英文Bitmap(位图)的简写,它是Windows操作系统中的标准图像文件格式
|
||||
public static final String IMAGE_TYPE_PNG = "png";// 可移植网络图形
|
||||
public static final String IMAGE_TYPE_PSD = "psd";// Photoshop的专用格式Photoshop
|
||||
|
||||
/**
|
||||
* RGB颜色范围上限
|
||||
*/
|
||||
private static final int RGB_COLOR_BOUND = 256;
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------- scale
|
||||
|
||||
@ -1952,7 +1958,7 @@ public class ImgUtil {
|
||||
if (null == random) {
|
||||
random = RandomUtil.getRandom();
|
||||
}
|
||||
return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
|
||||
return new Color(random.nextInt(RGB_COLOR_BOUND), random.nextInt(RGB_COLOR_BOUND), random.nextInt(RGB_COLOR_BOUND));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -522,10 +522,11 @@ public class RandomUtil {
|
||||
*
|
||||
* @return 随机颜色
|
||||
* @since 4.1.5
|
||||
* @deprecated 使用{@link ImagUtil#randomColor()}
|
||||
*/
|
||||
public static Color randomColor() {
|
||||
final Random random = getRandom();
|
||||
return new Color(random.nextInt(255), random.nextInt(255), random.nextInt(255));
|
||||
return new Color(random.nextInt(256), random.nextInt(2565), random.nextInt(256));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user