-
Notifications
You must be signed in to change notification settings - Fork 4
/
titles.yaml
executable file
·288 lines (271 loc) · 7.33 KB
/
titles.yaml
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
group_title:
tap_action:
action: none
show_icon: false
show_name: true
styles:
card:
- background-color: transparent
- box-shadow: none
- padding: 0 0 0.3rem 0.4rem
grid:
- grid-template-areas: "'n' 'l'"
- grid-template-columns: 1fr
- grid-template-rows: min-content min-content
name:
- place-self: start
- font-weight: normal
- font-size: 1.5vw
subtitle:
template:
- group_title
styles:
name:
- font-size: 1.2rem
- filter: "opacity(50%)"
card:
- padding: 0.5rem 0 0.5rem 0.5rem
icon_title:
variables:
title: ''
subtitle: false
icon_color: '#00C854'
template:
- base_icon_name
aspect_ratio: ''
show_icon: true
show_state: false
show_name: true
show_label: true
name: |
[[[ return variables.title ]]]
label: |
[[[
if (variables.subtitle) {
return variables.subtitle
}
return undefined
]]]
styles:
grid:
- grid-template-areas: |
[[[
if (variables.subtitle) {
return '"i n" "i l"'
} else {
return '"i n"'
}
]]]
- grid-template-columns: 0.15fr 0.85fr
- grid-template-rows: |
[[[
if (variables.subtitle) {
return 'min-content min-content'
} else {
return 'min-content'
}
]]]
name:
- font-size: 2rem
- font-weight: 500
- padding: 0 0 0 1rem
icon:
- width: 2.3rem
- height: 2.3rem
- color: |
[[[
var color = variables.icon_color
if (entity) {
color = variables.is_active ? variables.icon_color : 'var(--custom-icon-color-not-active)'
}
return color
]]]
- filter: |
[[[
var filter = `drop-shadow(0 0 var(--button-card-icon-drop-shadow-size) ${variables.icon_color})`
if (entity && !variables.is_active) {
filter = 'none'
}
return filter
]]]
img_cell:
- justify-self: start
- width: 3.5rem
- height: 3.5rem
- background-color: var(--card-background-color)
- box-shadow: |
[[[
var box_shadow = '0 0 var(--button-card-img-cell-box-shadow-size) ' + variables.icon_color
if (entity && !variables.is_active) {
box_shadow = 'none'
}
return box_shadow
]]]
label:
- padding: 0 0 0 1rem
- filter: "opacity(40%)"
- font-size: 1.2rem
- justify-self: start
- text-overflow: unset
- white-space: unset
- word-break: break-word
- text-align: initial
- text-justify: none
card:
- background-color: transparent
- justify-self: start
- border-radius: 0
- box-shadow: none
- margin: 0 0 0 0
- padding: 1.5rem 0.75rem 1.5rem 0.75rem
- max-width: 100%
welcome_title:
template:
- icon_title
variables:
title: Koti
subtitle: |
[[[
let time = states['sensor.time'].state;
let welcome = '';
if (time > '18:00'){
welcome = "Iltaa";
} else if (time > '12:00'){
welcome = "Päivää";
} else if (time > '05:00'){
welcome = "Huomenta";
} else {
welcome = "Hei";
}
return welcome + ', ' + user.name + '!';
]]]
custom_fields:
weather:
card:
type: custom:button-card
show_state: false
show_icon: false
show_label: false
show_name: false
show_entity_picture: true
tap_action:
!include ../../popups/mobile/weather-forecast.yaml
entity: "[[[ return variables.entity_weather ]]]"
entity_picture: "[[[ return `/local/img/weather/${states[variables.entity_weather].state}.svg` ]]]"
styles:
grid:
- grid-template-areas: |
"i"
- grid-template-columns: 1fr
- grid-template-rows: 1fr
img_cell:
- justify-content: center
icon:
- width: 4.0rem
- height: 3.5rem
card:
- background-color: transparent
- box-shadow: none
temp:
card:
type: custom:button-card
show_state: true
show_icon: false
show_label: false
show_name: false
entity: |
[[[
if (variables.entity_temperature) {
return variables.entity_temperature
} else if (variables.entity_weather) {
return variables.entity_weather
} else {
return undefined
}
]]]
state_display: |
[[[
var temperature = states[variables.entity_weather].attributes.temperature
if (variables.entity_temperature) {
temperature = states[variables.entity_temperature].state
}
return `<div><span class="value">${temperature}</span><span class="unit">°C</span></div>`
]]]
extra_styles: |
span.unit {
font-size: 1.4rem;
}
styles:
grid:
- grid-template-areas: |
"s"
- grid-template-columns: 1fr
- grid-template-rows: 1fr
state:
- justify-self: center
- align-self: center
- font-weight: 300
- font-size: 2rem
- filter: "opacity(40%)"
card:
- background-color: transparent
- box-shadow: none
styles:
grid:
- grid-template-areas: |
"i n temp weather"
"i l temp weather"
- grid-template-columns: 0.15fr 0.5fr 0.2fr 0.15fr
- grid-template-rows: repeat(2, min-content)
- justify-items: stretch
custom_fields:
weather:
- place-self: center start
- margin-left: 0.8rem
temp:
- place-self: center end
- padding-right: 0.9rem
- border-right: 0.1rem solid rgba(var(--primary-text-color-rgb), 0.4)
sticky_title:
custom_fields:
scroll: |
[[[
const element = this;
function updateStyle() {
let opacity = 0.8;
let blur = '5px';
let boxShadow = '0 2px 4px 0 rgba(0,0,0,.4)';
if (document.documentElement.scrollTop < 5) {
opacity = 0;
blur = '0px';
boxShadow = 'none';
}
const card = element.shadowRoot.querySelector("#card");
card.style.background = `rgba(var(--card-background-color-rgb), ${opacity})`;
card.style['backdrop-filter'] = `blur(${blur})`;
card.style['-webkit-backdrop-filter'] = `blur(${blur})`;
card.style['box-shadow'] = boxShadow;
}
window.addEventListener('scroll', updateStyle, { passive: true })
]]]
styles:
card:
- padding: 1.7rem var(--view-side-margin)
- top: 0
- left: 0
- z-index: 1
- overflow: hidden
- position: fixed
- border-radius: 0
- box-shadow: none
- height: 7rem
- '--mdc-ripple-press-opacity': 0
- transition: all 0.7s ease
mobile_welcome_title:
template:
- welcome_title
- sticky_title
mobile_view_title:
template:
- icon_title
- sticky_title