我正在使用AdaptiveCard SDK v1.2.6。使用此示例卡,该卡使用3种可用样式进行操作(默认,肯定,破坏性),似乎我只能控制positive
卡的背景颜色,并且它的工作方式不是很直观。
我正在使用的卡:
{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type":"TextBlock",
"wrap":true,
"text":"There are also still actions at the bottom of the card"
}
],
"actions":[
{
"type":"Action.ShowCard",
"title":"Positive",
"style":"positive",
"card":{
"type":"AdaptiveCard",
"body":[
{
"type":"TextBlock",
"text":"This is a show card"
}
]
}
},
{
"type":"Action.OpenUrl",
"title":"Desctructive",
"url":"https://adaptivecards.io",
"style":"destructive"
},
{
"type":"Action.Submit",
"title":"Default",
"data":{
"x":13
}
}
]
}
以及我正在使用的主机配置:
{
"hostCapabilities": {
"capabilities": null
},
"choiceSetInputValueSeparator": ",",
"supportsInteractivity": true,
"fontFamily": "Arial",
"spacing": {
"small": 4,
"default": 12,
"medium": 12,
"large": 12,
"extraLarge": 16,
"padding": 12
},
"separator": {
"lineThickness": 1,
"lineColor": "#EEEEEE"
},
"fontSizes": {
"small": 12,
"default": 14,
"medium": 16,
"large": 20,
"extraLarge": 22
},
"fontWeights": {
"lighter": 300,
"default": 400,
"bolder": 600
},
"imageSizes": {
"small": 40,
"medium": 80,
"large": 160
},
"containerStyles": {
"default": {
"foregroundColors": {
"default": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"dark": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"light": {
"default": "#B4B6B8",
"subtle": "#929596"
},
"accent": {
"default": "#CE2D4F", // this affects the "positive" action for some reason
"subtle": "#00A0D1"
},
"good": {
"default": "#44CF50",
"subtle": "#7FEB86"
},
"warning": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
},
"attention": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
}
},
"backgroundColor": "#24282B"
},
"emphasis": {
"foregroundColors": {
"default": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"dark": {
"default": " #FFFFFF",
"subtle": "#E6E8E8"
},
"light": {
"default": "#B4B6B8",
"subtle": "#929596"
},
"accent": {
"default": "#1DC4F2",
"subtle": "#00A0D1"
},
"good": {
"default": "#44CF50",
"subtle": "#7FEB86"
},
"warning": {
"default": "#FF5C4A",
"subtle": "#FF9987"
},
"attention": {
"default": "#FF9D52",
"subtle": "#FFCA99"
}
},
"backgroundColor": "#535759"
},
"good": {
"foregroundColors": {
"default": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"dark": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"light": {
"default": "#B4B6B8",
"subtle": "#929596"
},
"accent": {
"default": "#1DC4F2",
"subtle": "#00A0D1"
},
"good": {
"default": "#44CF50",
"subtle": "#7FEB86"
},
"warning": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
},
"attention": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
}
},
"backgroundColor": "#17451E"
},
"accent": {
"foregroundColors": {
"default": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"dark": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"light": {
"default": "#B4B6B8",
"subtle": "#929596"
},
"accent": {
"default": "#1DC4F2",
"subtle": "#00A0D1"
},
"good": {
"default": "#44CF50",
"subtle": "#7FEB86"
},
"warning": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
},
"attention": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
}
},
"backgroundColor": "#124052"
},
"warning": {
"foregroundColors": {
"default": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"dark": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"light": {
"default": "#B4B6B8",
"subtle": "#929596"
},
"accent": {
"default": "#1DC4F2",
"subtle": "#00A0D1"
},
"good": {
"default": "#44CF50",
"subtle": "#7FEB86"
},
"warning": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
},
"attention": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
}
},
"backgroundColor": "#632926"
},
"attention": {
"foregroundColors": {
"default": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"dark": {
"default": "#FFFFFF",
"subtle": "#E6E8E8"
},
"light": {
"default": "#B4B6B8",
"subtle": "#929596"
},
"accent": {
"default": "#1DC4F2",
"subtle": "#00A0D1"
},
"good": {
"default": "#44CF50",
"subtle": "#7FEB86"
},
"warning": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
},
"attention": {
"default": "#FF5C4A",
"subtle": "#FF5C4A"
}
},
"backgroundColor": "#543511"
}
},
"actions": {
"maxActions": 5,
"buttonSpacing": 8,
"showCard": {
"actionMode": "Inline",
"inlineTopMargin": 8,
"style": "emphasis"
},
"style": "emphasis",
"preExpandSingleShowCardAction": false,
"actionsOrientation": "Vertical",
"actionAlignment": "stretch"
},
"adaptiveCard": {
"allowCustomStyle": false
},
"imageSet": {
"maxImageHeight": 100
},
"media": {
"allowInlinePlayback": false
},
"factSet": {
"title": {
"size": "Default",
"color": "Default",
"isSubtle": false,
"weight": "Bolder",
"wrap": true
},
"value": {
"size": "Default",
"color": "Default",
"isSubtle": false,
"weight": "Default",
"wrap": true
},
"spacing": 10
},
"cssClassNamePrefix": null
}
提供此卡:
positive
卡似乎只在我修改“ containerStyles”->“默认”->“ foregroundColors”->“重音”->“默认”下的十六进制值时才更改颜色,这对我来说意义为零(仅通过反复试验才发现此问题,因为文档不能很好地解释这一点)。
[我也探索过使用extensibility来呈现自己的动作,但似乎不被支持,因为没有用于动作的ACRCardElementType
枚举(仅动作集)。
因此我有以下问题:
为什么正面效果背景色会受到该特定属性的影响?
我如何修改其他动作的背景色(以及它们如何获取其当前值)?
是否可以使用可扩展性来呈现这些操作按钮?
恐怕现在只能使用CSS更改操作样式(所有按钮)。 HostConfig对按钮的颜色没有影响。
对于iOS,如果您熟悉XIB,则可以通过XIB更改按钮的样式。 https://docs.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/ios/native-styling
如果没有,则可以通过重写相应的渲染器来更新UI元素(例如按钮)。 https://docs.microsoft.com/en-us/adaptive-cards/sdk/rendering-cards/ios/extensibility