MAML实用小工具,万能的调色板

由于当前锁屏文字或其他元素暂时无法像桌面那样自动变换不同的颜色,我们可通过下面的调色板功能手动给元素赋予颜色,如图:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

瞅代码

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?xml version="1.0" encoding="utf-8"?>
<Lockscreen version="1" frameRate="60" screenWidth="1080" >
 <Rectangle w="1080" h="2040" fillColor="#FFFFFF" />
 
 <!-- 颜色输出值 通过argb调用 默认argb颜色为argb(255,80,190,255) 可更改为自己需要的默认值--> 
 <Var name="AlphaOut" expression="ifelse(#DefaultColor==0,255,#AlphaOut) "/>
 <Var name="RedOut" expression="ifelse(#DefaultColor==0,80,#RedOut)" />
 <Var name="GreenOut" expression="ifelse(#DefaultColor==0,190,#GreenOut)"/>
 <Var name="BlueOut" expression="ifelse(#DefaultColor==0,255,#BlueOut)"/>
 
 <!-- 输出背景颜色 通过argb调用实例 -->
 <Rectangle w="1080" h="2040" fillColor="argb(#AlphaOut,#RedOut,#GreenOut,#BlueOut)" />
 <DateTime x="540" y="200" color="#FFFFFF" size="150" format="HH:mm" align="center" fontFamily="miui-thin"/>
 
 <!-- 界面层 -->
 <Group>
 <Rectangle x="540" y="1060" w="1020" h="1160" fillColor="#ffffff" cornerRadius="20,20" align="center" alignV="center" />
 <!-- 棋盘网格背景 -->
 <Array x="120" y="700" count="49" indexName="Bgalp" >
 <Rectangle x="#Bgalp%7*40" y="int(#Bgalp/7)*40" w="40" h="40" fillColor="argb(255,ifelse(#Bgalp%2==1,204,255),ifelse(#Bgalp%2==1,204,255),ifelse(#Bgalp%2==1,204,255))" /> 
 </Array> 
 <Rectangle x="120" y="700" w="280" h="280" strokeColor="#30000000" weight="4" />
 <!-- 颜色混合界面 -->
 <Group x="260" y="1100" align="center" alignV="center" w="300" h="300" layered="true">
 <Array count="3" alignV="center" indexName="ColorXfer">
 <Circle x="150" y="150" r="50" fillColor="argb(255,ifelse(eq(#ColorXfer%3,0),#Red,0),ifelse(eq(#ColorXfer%3,1),#Green,0),ifelse(eq(#ColorXfer%3,2),#Blue,0))" xfermode="" centerY="30" angle="120*#ColorXfer" xfermode="Screen"/>
 </Array>
 </Group>
 <!-- 调色滑块界面 --> 
 <Array count="4" indexName="panal">
 <Rectangle x="510" y="730+#panal*150" w="440" h="10" fillColor="argb(255,ifelse(#panal==0,255,#panal==1,95,#panal==2,95,205),ifelse(#panal==0,80,#panal==1,180,#panal==2,145,205),ifelse(#panal==0,120,#panal==1,105,#panal==2,220,205))" cornerRadius="5,5" alignV="center" />
 <Circle x="520+ifelse(#panal==0,#RedMove,#panal==1,#GreenMove,#panal==2,#BlueMove,#AlphaMove)" y="730+#panal*150" r="35" fillColor="#4ebeff"/>
 </Array>
 
 <!-- 实时艳色输出 -->
 <Circle x="260" y="840" r="125" fillColor="argb(255-#ColorAlpha,#Red,#Green,#Blue)"/>
 <Text x="540" y="1550" color="#30000000" size="30" text="左右滑动滑块调整颜色" align="center" />
 </Group>
 
 <!-- 控制层 红色划块-->
 <Var name="Red" expression="max(min(ifelse(#Red_flag==1,(#touch_x-#touch_begin_x)*255/420,0)+#RedX2*255/420,255),0)" />
 <Var name="RedMove" expression="max(min(ifelse(#Red_flag==1,#touch_x-#touch_begin_x,0)+#RedX2,420),0)" />
 <Button x="520+#RedMove" y="730" w="100" h="100" align="center" alignV="center" >
 <Triggers>
 <Trigger action="down">
 <VariableCommand name="Red_flag" expression="1"/>
 </Trigger>
 <Trigger action="up,cancel">
 <VariableCommand name="Red_flag" expression="0" /> 
 <VariableCommand name="RedX2" expression="max(min(#RedX2+#touch_x-#touch_begin_x,420),0)" persist="true"/>
 </Trigger>
 </Triggers>
 </Button>
 
 <!-- 控制层 绿色划块-->
 <Var name="Green" expression="max(min(ifelse(#Green_flag==1,(#touch_x-#touch_begin_x)*255/420,0)+#GreenX2*255/420,255),0)" />
 <Var name="GreenMove" expression="max(min(ifelse(#Green_flag==1,#touch_x-#touch_begin_x,0)+#GreenX2,420),0)" />
 <Button x="520+#GreenMove" y="880" w="100" h="100" align="center" alignV="center" >
 <Triggers>
 <Trigger action="down">
 <VariableCommand name="Green_flag" expression="1"/>
 </Trigger>
 <Trigger action="up,cancel">
 <VariableCommand name="Green_flag" expression="0" /> 
 <VariableCommand name="GreenX2" expression="max(min(#GreenX2+#touch_x-#touch_begin_x,420),0)" persist="true"/>
 </Trigger>
 </Triggers>
 </Button>
 
 <!-- 控制层 蓝色划块-->
 <Var name="Blue" expression="max(min(ifelse(#Blue_flag==1,(#touch_x-#touch_begin_x)*255/420,0)+#BlueX2*255/420,255),0)" />
 <Var name="BlueMove" expression="max(min(ifelse(#Blue_flag==1,#touch_x-#touch_begin_x,0)+#BlueX2,420),0)" />
 <Button x="520+#BlueMove" y="1030" w="100" h="100" align="center" alignV="center" >
 <Triggers>
 <Trigger action="down">
 <VariableCommand name="Blue_flag" expression="1"/>
 </Trigger>
 <Trigger action="up,cancel">
 <VariableCommand name="Blue_flag" expression="0" />
 
 <VariableCommand name="BlueX2" expression="max(min(#BlueX2+#touch_x-#touch_begin_x,420),0)" persist="true"/>
 </Trigger>
 </Triggers>
 </Button>
 
 <!-- 控制层 透明度划块-->
 <Var name="ColorAlpha" expression="max(min(ifelse(#Alpha_flag==1,(#touch_x-#touch_begin_x)*255/420,0)+#AlphaX2*255/420,255),0)" />
 <Var name="AlphaMove" expression="max(min(ifelse(#Alpha_flag==1,#touch_x-#touch_begin_x,0)+#AlphaX2,420),0)" />
 <Button x="520+#AlphaMove" y="1180" w="100" h="100" align="center" alignV="center" >
 <Triggers>
 <Trigger action="down">
 <VariableCommand name="Alpha_flag" expression="1" />
 </Trigger>
 <Trigger action="up,cancel">
 <VariableCommand name="Alpha_flag" expression="0" />
 <VariableCommand name="AlphaX2" expression="max(min(#AlphaX2+#touch_x-#touch_begin_x,420),0)" persist="true"/>
 </Trigger>
 </Triggers>
 </Button>
 
 <!-- 输出按钮-->
 <Rectangle x="320" y="1400" w="240" h="100" fillColor="#5e90db" cornerRadius="50,50" align="center" alignV="center" />
 <Rectangle x="760" y="1400" w="240" h="100" fillColor="#db5e90" cornerRadius="50,50" align="center" alignV="center" />
 <Text x="320" y="1400" color="#FFFFFF" size="35" text="更改颜色" align="center" alignV="center"/>
 <Text x="760" y="1400" color="#FFFFFF" size="35" text="恢复默认" align="center" alignV="center"/>
 
 <!-- 更改颜色按钮-->
 <Button x="320" y="1400" w="240" h="100" align="center" alignV="center">
 <Triggers>
 <Trigger action="up">
 <VariableCommand name="AlphaOut" expression="255-#ColorAlpha" persist="true"/>
 <VariableCommand name="BlueOut" expression="#Blue" persist="true"/>
 <VariableCommand name="RedOut" expression="#Red" persist="true"/>
 <VariableCommand name="GreenOut" expression="#Green" persist="true"/>
 <VariableCommand name="DefaultColor" expression="1" persist="true"/>
 </Trigger>
 </Triggers>
 </Button>
 
 <!-- 恢复默认颜色按钮--> 
 <Button x="760" y="1400" w="240" h="100" align="center" alignV="center">
 <Triggers>
 <Trigger action="up">
 <VariableCommand name="DefaultColor" expression="0" persist="true"/>
 </Trigger>
 </Triggers>
 </Button>
 
 <Text x="540" y="1820+#unlocker.move_y" color="#FFFFFF" size="35" text="上划解锁" align="center" />
 <!-- 上滑解锁 -->
 <Unlocker name="unlocker" alwaysShow="true">
 <StartPoint x="0" y="0" w="#screen_width" h="#screen_height" easeType="BounceEaseOut" easeTime="600"/>
 <EndPoint x="0" y="-#screen_height-300" w="#screen_width" h="#screen_height" >
 <Path x="0" y="0" tolerance="2000">
 <Position x="0" y="0" />
 <Position x="0" y="-#screen_height" />
 </Path>
 </EndPoint>
 </Unlocker>
 
 
 
</Lockscreen>

1 条评论

  • 匿名 2017年5月12日 回复

    有支持rgb的颜色代码吗?

发表评论

电子邮件地址不会被公开。

©2015-2016 zhutidasai.com. 版权所有 京ICP备16041368号-3