GREY_50_PERCENT
时间: 2024-05-24 22:08:55 浏览: 22
GREY_50_PERCENT是CSS的颜色属性之一,表示灰色50%的色调。在HTML中可以使用该属性设置元素的背景色或字体颜色。
以下是使用CSS将元素的背景色设置为GREY_50_PERCENT的例子[^1]:
```css
background-color: #808080;
```
以下是使用CSS将元素的字体颜色设置为GREY_50_PERCENT的例子[^2]:
```css
color: #808080;
```
相关问题
转化为 lambda 表达式.registerWriteHandler(new CellWriteHandler() { @Override public void afterCellDispose(CellWriteHandlerContext context) { // 判断是否是标题 if (BooleanUtils.isNotTrue(context.getHead())) { WriteCellData<?> cellData = context.getFirstCellData(); WriteCellStyle writeCellStyle = cellData.getOrCreateStyle(); writeCellStyle.setBorderBottom(BorderStyle.THIN); writeCellStyle.setBorderLeft(BorderStyle.THIN); writeCellStyle.setBorderRight(BorderStyle.THIN); writeCellStyle.setBorderTop(BorderStyle.THIN); writeCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex()); writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); } else if (BooleanUtils.isTrue(context.getHead())) { WriteCellData<?> cellData = context.getFirstCellData(); WriteCellStyle writeCellStyle = cellData.getOrCreateStyle(); writeCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); writeCellStyle.setShrinkToFit(true); writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); } } });
这段代码可以转换为以下的 lambda 表达式:
```
registerWriteHandler((CellWriteHandler) context -> {
if (BooleanUtils.isNotTrue(context.getHead())) {
WriteCellData<?> cellData = context.getFirstCellData();
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
writeCellStyle.setBorderBottom(BorderStyle.THIN);
writeCellStyle.setBorderLeft(BorderStyle.THIN);
writeCellStyle.setBorderRight(BorderStyle.THIN);
writeCellStyle.setBorderTop(BorderStyle.THIN);
writeCellStyle.setFillForegroundColor(IndexedColors.WHITE.getIndex());
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
} else if (BooleanUtils.isTrue(context.getHead())) {
WriteCellData<?> cellData = context.getFirstCellData();
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
writeCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
writeCellStyle.setShrinkToFit(true);
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
}
});
```
可以看到,lambda 表达式将原先的匿名内部类转化为了一个函数式接口的实现,代码更加简洁。
要一份easyexcel色号跟IndexedColors的映射表
EasyExcel中的颜色是通过IndexedColors枚举类型来表示的。下面给出一份IndexedColors枚举类型与颜色的映射表,以供参考:
| IndexedColors 枚举类型 | 颜色 |
| --------------------- | ---- |
| BLACK | 黑色 |
| WHITE | 白色 |
| RED | 红色 |
| BRIGHT_GREEN | 鲜绿色 |
| BLUE | 蓝色 |
| YELLOW | 黄色 |
| PINK | 粉红色 |
| TURQUOISE | 青绿色 |
| DARK_RED | 深红色 |
| GREEN | 绿色 |
| DARK_BLUE | 深蓝色 |
| DARK_YELLOW | 深黄色 |
| VIOLET | 紫色 |
| TEAL | 青色 |
| GREY_25_PERCENT | 灰色(25%) |
| GREY_50_PERCENT | 灰色(50%) |
| CORNFLOWER_BLUE | 矢车菊蓝 |
| MAROON | 栗色 |
| LEMON_CHIFFON | 柠檬绸色 |
| ORCHID | 暗兰紫色 |
| CORAL | 珊瑚色 |
| ROYAL_BLUE | 苍蓝色 |
| LIGHT_CORNFLOWER_BLUE | 浅矢车菊蓝 |
| SKY_BLUE | 天蓝色 |
| LIGHT_TURQUOISE | 浅青绿色 |
| LIGHT_GREEN | 浅绿色 |
| LIGHT_YELLOW | 浅黄色 |
| PALE_BLUE | 淡蓝色 |
| ROSE | 玫瑰红色 |
| LAVENDER | 淡紫色 |
| TAN | 淡褐色 |
| LIGHT_BLUE | 浅蓝色 |
| AQUA | 浅水绿色 |
| LIME | 淡黄绿色 |
| GOLD | 金色 |
| LIGHT_ORANGE | 浅橙色 |
| ORANGE | 橙色 |
| BLUE_GREY | 灰蓝色 |
| GREY_40_PERCENT | 灰色(40%) |
| DARK_TEAL | 深青色 |
| SEA_GREEN | 海绿色 |
| DARK_GREEN | 深绿色 |
| OLIVE_GREEN | 橄榄绿色 |
| BROWN | 棕色 |
| PLUM | 深紫色 |
| INDIGO | 靛蓝色 |
| GREY_80_PERCENT | 灰色(80%) |
| AUTOMATIC | 自动 |
需要注意的是,EasyExcel的IndexedColors枚举类型与Apache POI中的IndexedColors枚举类型是一致的。因此,上面给出的映射表也适用于Apache POI。
相关推荐
![html](https://img-home.csdnimg.cn/images/20210720083451.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)