colorful-ionput

This commit is contained in:
Eason010212
2024-06-29 16:10:40 +08:00
parent 838f97ddf1
commit 4372749814
2 changed files with 28 additions and 11 deletions

View File

@@ -209,6 +209,10 @@
"红", "橙", "黄", "绿", "青", "蓝", "紫", "白", "黑", "灰", "棕", "红", "橙", "黄", "绿", "青", "蓝", "紫", "白", "黑", "灰", "棕",
"red", "orange", "yellow", "green", "cyan", "blue", "purple", "white", "black", "grey", "brown" "red", "orange", "yellow", "green", "cyan", "blue", "purple", "white", "black", "grey", "brown"
</p> </p>
<p>
也支持RGB通道格式和16进制颜色例如
"255,0,0", "#ff0000"
</p>
<h3>可配置项</h3> <h3>可配置项</h3>
<p> <p>
<span style="color:#4e73df;">组件名称</span> - 组件的名称用于在页面上显示并作为逻辑视图控制的唯一id。 <span style="color:#4e73df;">组件名称</span> - 组件的名称用于在页面上显示并作为逻辑视图控制的唯一id。

View File

@@ -1757,19 +1757,32 @@ function add_bulb(user_title, user_topic, user_content, user_style, title_style)
bulb.attr('class', 'bulb3') bulb.attr('class', 'bulb3')
} }
else{ else{
var availableMessageStrings = [ if (message1.toString().indexOf("#") != -1) {
"红", "橙", "黄", "绿", "青", "蓝", "紫", "白", "黑", "灰", "棕", title.parent().parent().attr('user-content', message1);
"red", "orange", "yellow", "green", "cyan", "blue", "purple", "white", "black", "grey", "brown" bulb.css('background-color', message1);
] bulb.css('box-shadow', message1 + ' 1px 1px 8px')
for (var avaMessage of availableMessageStrings) { }
console.log(message1.toString(), avaMessage) else if (message1.toString().split(",").length == 3) {
if (message1.toString()=== avaMessage) { title.parent().parent().attr('user-content', message1);
title.parent().parent().attr('user-content', avaMessage); bulb.css('background-color', 'rgb(' + message1 + ')');
bulb.css('background-color', message1); bulb.css('box-shadow', 'rgb(' + message1 + ') 1px 1px 8px')
bulb.css('box-shadow', message1 + ' 1px 1px 8px') }
break; else{
var availableMessageStrings = [
"红", "橙", "黄", "绿", "青", "蓝", "紫", "白", "黑", "灰", "棕",
"red", "orange", "yellow", "green", "cyan", "blue", "purple", "white", "black", "grey", "brown"
]
for (var avaMessage of availableMessageStrings) {
console.log(message1.toString(), avaMessage)
if (message1.toString()=== avaMessage) {
title.parent().parent().attr('user-content', avaMessage);
bulb.css('background-color', message1);
bulb.css('box-shadow', message1 + ' 1px 1px 8px')
break;
}
} }
} }
} }
itemdiv.trigger(MixIO.eventTags.BULB_CHANGED, [Uint8ArrayToString(message1)]) itemdiv.trigger(MixIO.eventTags.BULB_CHANGED, [Uint8ArrayToString(message1)])
} }