File: colorusage.py

package info (click to toggle)
kivy 2.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 35,316 kB
  • sloc: python: 80,678; ansic: 5,326; javascript: 780; objc: 725; lisp: 195; sh: 173; makefile: 150
file content (62 lines) | stat: -rw-r--r-- 1,471 bytes parent folder | download | duplicates (3)
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
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.lang import Builder

Builder.load_string("""
#:import hex kivy.utils.get_color_from_hex

<Root>:
    cols: 2
    canvas:
        Color:
            rgba: 1, 1, 1, 1
        Rectangle:
            pos: self.pos
            size: self.size

    Label:
        canvas.before:
            Color:
                rgb: 39/255., 174/255., 96/255.
            Rectangle:
                pos: self.pos
                size: self.size
        text: "rgb: 39/255., 174/255., 96/255."
    Label:
        canvas.before:
            Color:
                rgba: 39/255., 174/255., 96/255., 1
            Rectangle:
                pos: self.pos
                size: self.size
        text: "rgba: 39/255., 174/255., 96/255., 1"
    Label:
        canvas.before:
            Color:
                hsv: 145/360., 77.6/100, 68.2/100
            Rectangle:
                pos: self.pos
                size: self.size
        text: "hsv: 145/360., 77.6/100, 68.2/100"
    Label:
        canvas.before:
            Color:
                rgba: hex('#27ae60')
            Rectangle:
                pos: self.pos
                size: self.size
        text: "rgba: hex('#27ae60')"
""")


class Root(GridLayout):
    pass


class ColorusageApp(App):
    def build(self):
        return Root()


if __name__ == "__main__":
    ColorusageApp().run()