mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
优化QrCodeUtil
This commit is contained in:
parent
9543012fec
commit
62735daa36
@ -147,7 +147,9 @@ public class QrConfig {
|
|||||||
* @since 5.1.1
|
* @since 5.1.1
|
||||||
*/
|
*/
|
||||||
public QrConfig setForeColor(Color foreColor) {
|
public QrConfig setForeColor(Color foreColor) {
|
||||||
if(null != foreColor){
|
if(null == foreColor){
|
||||||
|
this.foreColor = null;
|
||||||
|
} else {
|
||||||
this.foreColor = foreColor.getRGB();
|
this.foreColor = foreColor.getRGB();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
|
@ -135,8 +135,8 @@ public class QrCodeUtilTest {
|
|||||||
@Test
|
@Test
|
||||||
public void generateAsciiArtTest() {
|
public void generateAsciiArtTest() {
|
||||||
QrConfig qrConfig = QrConfig.create()
|
QrConfig qrConfig = QrConfig.create()
|
||||||
.setForeColor(new Color(255,0,255))
|
.setForeColor(Color.BLUE)
|
||||||
.setBackColor(new Color(0,255,0))
|
.setBackColor(Color.MAGENTA)
|
||||||
.setWidth(0)
|
.setWidth(0)
|
||||||
.setHeight(0).setMargin(1);
|
.setHeight(0).setMargin(1);
|
||||||
String asciiArt = QrCodeUtil.generateAsAsciiArt("https://hutool.cn/",qrConfig);
|
String asciiArt = QrCodeUtil.generateAsAsciiArt("https://hutool.cn/",qrConfig);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user