sharepoint - 如何更改视图中 Sharepoint Online 列表列标题的背景和字体颜色?
问题描述
我正在尝试更改 Sharepoint Online 列表中视图中列标题的颜色,最好使用 Microsoft 为格式化视图提供的 JSON 模式。
我发现 Microsoft 的文档概述了许多有趣的示例,例如我可以使用 "hideColumnHeader": true 完全隐藏列标题,或者我可以更改组标题的颜色,但似乎没有任何文档说明如何更改列标题本身的背景颜色。
https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/view-formatting
我想要实现的目标非常简单。我想更改列标题背景颜色和字体颜色,并为不同的列设置不同的颜色,就像在 Excel 中可以轻松做到的那样:
这可能使用 JSON 模式吗?
在此先感谢您的时间。
解决方案
我最近发现并为行值实现了这一点,它也可能有助于列标题:
```` {
“$schema”:“https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json”,“elmType”:“div”,“txtContent”:“@currentField”, "style": { "color": "=if(@currentField == 'Purple 1', '#ffffff','')", "background-color": "=if(@currentField == 'Gold 1' , '#D7AC11', if(@currentField == 'Gold 2', '#DBBA2F', if(@currentField == 'Gold 3', '#F1D531', if(@currentField == 'Aqua 1', ' #008198', if(@currentField == 'Aqua 2', '#00bed8', if(@currentField == 'Aqua 3', '#75C7B9', if(@currentField == 'Green', '#84b638' , if(@currentField == '灰色 1', '#808285', if(@currentField == '灰色 2','#9d9fa2', if(@currentField == '灰色 3', '#bcbec0', if(@currentField == '灰色 4', '#e6e7e8', if(@currentField == '红色', '#ca4e28 ', if(@currentField == 'Purple 1', '#492f92', if(@currentField == 'Purple 2', '#9c8dc3', '' ) ) )) ) ) ) ))))) "
} }
推荐阅读
- asp.net-core - 如何从控制器中提取方法?
- python - 使用python将列表中的字典转换为JSON格式
- android - Android 11 媒体恢复发出第二次通知
- java - Java 8 Stream vs For 循环 - 修改列表中的对象,使用另一个列表中对象的属性
- flutter - Flutter 应用程序导航问题
- python-3.x - 为 python 3.6 安装软件包时 Pipenv 失败
- laravel - 如何在 Laravel Passport 中设置强密码
- python - 使用 Django Rest Framework 自动引用嵌套
- html - C++ If ("Char" == "value") { 做
- android - android - 设置关闭颜色