-
Notifications
You must be signed in to change notification settings - Fork 0
/
display_pages.yaml
38 lines (38 loc) · 1.7 KB
/
display_pages.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
- id: disabled
lambda: |-
Color black = Color(0x000000);
for (int i = 0; i <= it.get_height() - 1; ++i) {
it.draw_pixel_at(0, i, black);
}
- id: mono
lambda: |-
float brightness_begin = id(rgb_light_mosaic_begin).current_values.get_brightness();
Color top = Color(
(id(rgb_light_mosaic_begin).current_values.get_red() * brightness_begin * 255),
(id(rgb_light_mosaic_begin).current_values.get_green() * brightness_begin * 255),
(id(rgb_light_mosaic_begin).current_values.get_blue() * brightness_begin * 255)
);
for (int i = 0; i <= it.get_height() - 1; ++i) {
it.draw_pixel_at(0, i, top);
}
- id: gradient
lambda: |-
float brightness_begin = id(rgb_light_mosaic_begin).current_values.get_brightness();
Color top = Color(
(id(rgb_light_mosaic_begin).current_values.get_red() * brightness_begin * 255),
(id(rgb_light_mosaic_begin).current_values.get_green() * brightness_begin * 255),
(id(rgb_light_mosaic_begin).current_values.get_blue() * brightness_begin * 255)
);
float brightness_end = id(rgb_light_mosaic_end).current_values.get_brightness();
Color bottom = Color(
(id(rgb_light_mosaic_end).current_values.get_red() * brightness_end * 255),
(id(rgb_light_mosaic_end).current_values.get_green() * brightness_end * 255),
(id(rgb_light_mosaic_end).current_values.get_blue() * brightness_end * 255)
);
for (int i = 0; i <= it.get_height()-1; ++i) {
float t = i / float(it.get_height() - 1);
uint8_t r = top.r + t * (bottom.r - top.r);
uint8_t g = top.g + t * (bottom.g - top.g);
uint8_t b = top.b + t * (bottom.b - top.b);
it.draw_pixel_at(0, i, Color(r, g, b));
}