Skip to content

Commit 6aca794

Browse files
committed
Colors for Python
1 parent 2bb988a commit 6aca794

File tree

3 files changed

+362
-4
lines changed

3 files changed

+362
-4
lines changed

docs/roadmap.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* [x] Dropdown
3030
* [x] Checkbox
3131
* [x] RadioGroup and Radio
32-
* [ ] Slider
32+
* [x] Slider
3333
* [x] Switch
3434
* Dialogs, alerts and panels
3535
* [ ] Banner
@@ -738,6 +738,7 @@ Docs: https://api.flutter.dev/flutter/material/Switch-class.html
738738
Properties:
739739

740740
- value
741+
- label - use `{value}`
741742
- min
742743
- max
743744
- divisions

sdk/python/flet/colors.py

Lines changed: 357 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,357 @@
1+
# $lines = Get-Content "colors.dart"
2+
3+
# $section = ''
4+
5+
# foreach($line in $lines) {
6+
7+
# if ($line.Contains("case `"")) {
8+
# $color = $line.Replace('case "', "").replace('":', "").trim()
9+
# $ucolor = $color.toUpper()
10+
# "$ucolor = `"$color`""
11+
# } elseif ($line.Contains('Map<String, Color> _plainColors')) {
12+
# $section = 'plain'
13+
# } elseif ($line.Contains('Map<String, MaterialColor> _materialColors')) {
14+
# $section = 'primary'
15+
# } elseif ($line.Contains('Map<String, MaterialAccentColor> _materialAccentColors')) {
16+
# $section = 'accent'
17+
# } elseif ($line.startswith(' "')) {
18+
# $color = $line.split('"')[1]
19+
# $ucolor = $color.replace('deep', 'deep_').replace('light', 'light_').replace('grey', '_grey').replace('accent', '_accent').toUpper()
20+
21+
# "$ucolor = `"$color`""
22+
# if ($section -eq 'primary') {
23+
# $shades = @(50, 100, 200, 300, 400, 500, 600, 700, 800, 900)
24+
# foreach($shade in $shades) {
25+
# "$($ucolor)_$shade = `"$($color)$shade`""
26+
# }
27+
# } elseif ($section -eq 'accent') {
28+
# $shades = @(100, 200, 400, 700)
29+
# foreach($shade in $shades) {
30+
# "$($ucolor)_$shade = `"$($color)$shade`""
31+
# }
32+
# }
33+
# }
34+
35+
# }
36+
37+
PRIMARY = "primary"
38+
ON_PRIMARY = "onprimary"
39+
PRIMARY_CONTAINER = "primarycontainer"
40+
ON_PRIMARY_CONTAINER = "onprimarycontainer"
41+
SECONDARY = "secondary"
42+
ON_SECONDARY = "onsecondary"
43+
SECONDARY_CONTAINER = "secondarycontainer"
44+
ON_SECONDARY_CONTAINER = "onsecondarycontainer"
45+
TERTIARY = "tertiary"
46+
ON_TERTIARY = "ontertiary"
47+
TERTIARY_CONTAINER = "tertiarycontainer"
48+
ON_TERTIARY_CONTAINER = "ontertiarycontainer"
49+
ERROR = "error"
50+
ON_ERROR = "onerror"
51+
ERROR_CONTAINER = "errorcontainer"
52+
ON_ERROR_CONTAINER = "onerrorcontainer"
53+
OUTLINE = "outline"
54+
BACKGROUND = "background"
55+
ON_BACKGROUND = "onbackground"
56+
SURFACE = "surface"
57+
ON_SURFACE = "onsurface"
58+
SURFACE_VARIANT = "surfacevariant"
59+
ON_SURFACE_VARIANT = "onsurfacevariant"
60+
INVERSE_SURFACE = "inversesurface"
61+
ON_INVERSE_SURFACE = "oninversesurface"
62+
INVERSE_PRIMARY = "inverseprimary"
63+
SHADOW = "shadow"
64+
WHITE10 = "white10"
65+
WHITE12 = "white12"
66+
WHITE24 = "white24"
67+
WHITE30 = "white30"
68+
WHITE38 = "white38"
69+
WHITE54 = "white54"
70+
WHITE60 = "white60"
71+
WHITE70 = "white70"
72+
WHITE = "white"
73+
BLACK12 = "black12"
74+
BLACK26 = "black26"
75+
BLACK38 = "black38"
76+
BLACK45 = "black45"
77+
BLACK54 = "black54"
78+
BLACK87 = "black87"
79+
BLACK = "black"
80+
RED = "red"
81+
RED_50 = "red50"
82+
RED_100 = "red100"
83+
RED_200 = "red200"
84+
RED_300 = "red300"
85+
RED_400 = "red400"
86+
RED_500 = "red500"
87+
RED_600 = "red600"
88+
RED_700 = "red700"
89+
RED_800 = "red800"
90+
RED_900 = "red900"
91+
PINK = "pink"
92+
PINK_50 = "pink50"
93+
PINK_100 = "pink100"
94+
PINK_200 = "pink200"
95+
PINK_300 = "pink300"
96+
PINK_400 = "pink400"
97+
PINK_500 = "pink500"
98+
PINK_600 = "pink600"
99+
PINK_700 = "pink700"
100+
PINK_800 = "pink800"
101+
PINK_900 = "pink900"
102+
PURPLE = "purple"
103+
PURPLE_50 = "purple50"
104+
PURPLE_100 = "purple100"
105+
PURPLE_200 = "purple200"
106+
PURPLE_300 = "purple300"
107+
PURPLE_400 = "purple400"
108+
PURPLE_500 = "purple500"
109+
PURPLE_600 = "purple600"
110+
PURPLE_700 = "purple700"
111+
PURPLE_800 = "purple800"
112+
PURPLE_900 = "purple900"
113+
DEEP_PURPLE = "deeppurple"
114+
DEEP_PURPLE_50 = "deeppurple50"
115+
DEEP_PURPLE_100 = "deeppurple100"
116+
DEEP_PURPLE_200 = "deeppurple200"
117+
DEEP_PURPLE_300 = "deeppurple300"
118+
DEEP_PURPLE_400 = "deeppurple400"
119+
DEEP_PURPLE_500 = "deeppurple500"
120+
DEEP_PURPLE_600 = "deeppurple600"
121+
DEEP_PURPLE_700 = "deeppurple700"
122+
DEEP_PURPLE_800 = "deeppurple800"
123+
DEEP_PURPLE_900 = "deeppurple900"
124+
INDIGO = "indigo"
125+
INDIGO_50 = "indigo50"
126+
INDIGO_100 = "indigo100"
127+
INDIGO_200 = "indigo200"
128+
INDIGO_300 = "indigo300"
129+
INDIGO_400 = "indigo400"
130+
INDIGO_500 = "indigo500"
131+
INDIGO_600 = "indigo600"
132+
INDIGO_700 = "indigo700"
133+
INDIGO_800 = "indigo800"
134+
INDIGO_900 = "indigo900"
135+
BLUE = "blue"
136+
BLUE_50 = "blue50"
137+
BLUE_100 = "blue100"
138+
BLUE_200 = "blue200"
139+
BLUE_300 = "blue300"
140+
BLUE_400 = "blue400"
141+
BLUE_500 = "blue500"
142+
BLUE_600 = "blue600"
143+
BLUE_700 = "blue700"
144+
BLUE_800 = "blue800"
145+
BLUE_900 = "blue900"
146+
LIGHT_BLUE = "lightblue"
147+
LIGHT_BLUE_50 = "lightblue50"
148+
LIGHT_BLUE_100 = "lightblue100"
149+
LIGHT_BLUE_200 = "lightblue200"
150+
LIGHT_BLUE_300 = "lightblue300"
151+
LIGHT_BLUE_400 = "lightblue400"
152+
LIGHT_BLUE_500 = "lightblue500"
153+
LIGHT_BLUE_600 = "lightblue600"
154+
LIGHT_BLUE_700 = "lightblue700"
155+
LIGHT_BLUE_800 = "lightblue800"
156+
LIGHT_BLUE_900 = "lightblue900"
157+
CYAN = "cyan"
158+
CYAN_50 = "cyan50"
159+
CYAN_100 = "cyan100"
160+
CYAN_200 = "cyan200"
161+
CYAN_300 = "cyan300"
162+
CYAN_400 = "cyan400"
163+
CYAN_500 = "cyan500"
164+
CYAN_600 = "cyan600"
165+
CYAN_700 = "cyan700"
166+
CYAN_800 = "cyan800"
167+
CYAN_900 = "cyan900"
168+
TEAL = "teal"
169+
TEAL_50 = "teal50"
170+
TEAL_100 = "teal100"
171+
TEAL_200 = "teal200"
172+
TEAL_300 = "teal300"
173+
TEAL_400 = "teal400"
174+
TEAL_500 = "teal500"
175+
TEAL_600 = "teal600"
176+
TEAL_700 = "teal700"
177+
TEAL_800 = "teal800"
178+
TEAL_900 = "teal900"
179+
GREEN = "green"
180+
GREEN_50 = "green50"
181+
GREEN_100 = "green100"
182+
GREEN_200 = "green200"
183+
GREEN_300 = "green300"
184+
GREEN_400 = "green400"
185+
GREEN_500 = "green500"
186+
GREEN_600 = "green600"
187+
GREEN_700 = "green700"
188+
GREEN_800 = "green800"
189+
GREEN_900 = "green900"
190+
LIGHT_GREEN = "lightgreen"
191+
LIGHT_GREEN_50 = "lightgreen50"
192+
LIGHT_GREEN_100 = "lightgreen100"
193+
LIGHT_GREEN_200 = "lightgreen200"
194+
LIGHT_GREEN_300 = "lightgreen300"
195+
LIGHT_GREEN_400 = "lightgreen400"
196+
LIGHT_GREEN_500 = "lightgreen500"
197+
LIGHT_GREEN_600 = "lightgreen600"
198+
LIGHT_GREEN_700 = "lightgreen700"
199+
LIGHT_GREEN_800 = "lightgreen800"
200+
LIGHT_GREEN_900 = "lightgreen900"
201+
LIME = "lime"
202+
LIME_50 = "lime50"
203+
LIME_100 = "lime100"
204+
LIME_200 = "lime200"
205+
LIME_300 = "lime300"
206+
LIME_400 = "lime400"
207+
LIME_500 = "lime500"
208+
LIME_600 = "lime600"
209+
LIME_700 = "lime700"
210+
LIME_800 = "lime800"
211+
LIME_900 = "lime900"
212+
YELLOW = "yellow"
213+
YELLOW_50 = "yellow50"
214+
YELLOW_100 = "yellow100"
215+
YELLOW_200 = "yellow200"
216+
YELLOW_300 = "yellow300"
217+
YELLOW_400 = "yellow400"
218+
YELLOW_500 = "yellow500"
219+
YELLOW_600 = "yellow600"
220+
YELLOW_700 = "yellow700"
221+
YELLOW_800 = "yellow800"
222+
YELLOW_900 = "yellow900"
223+
AMBER = "amber"
224+
AMBER_50 = "amber50"
225+
AMBER_100 = "amber100"
226+
AMBER_200 = "amber200"
227+
AMBER_300 = "amber300"
228+
AMBER_400 = "amber400"
229+
AMBER_500 = "amber500"
230+
AMBER_600 = "amber600"
231+
AMBER_700 = "amber700"
232+
AMBER_800 = "amber800"
233+
AMBER_900 = "amber900"
234+
ORANGE = "orange"
235+
ORANGE_50 = "orange50"
236+
ORANGE_100 = "orange100"
237+
ORANGE_200 = "orange200"
238+
ORANGE_300 = "orange300"
239+
ORANGE_400 = "orange400"
240+
ORANGE_500 = "orange500"
241+
ORANGE_600 = "orange600"
242+
ORANGE_700 = "orange700"
243+
ORANGE_800 = "orange800"
244+
ORANGE_900 = "orange900"
245+
DEEP_ORANGE = "deeporange"
246+
DEEP_ORANGE_50 = "deeporange50"
247+
DEEP_ORANGE_100 = "deeporange100"
248+
DEEP_ORANGE_200 = "deeporange200"
249+
DEEP_ORANGE_300 = "deeporange300"
250+
DEEP_ORANGE_400 = "deeporange400"
251+
DEEP_ORANGE_500 = "deeporange500"
252+
DEEP_ORANGE_600 = "deeporange600"
253+
DEEP_ORANGE_700 = "deeporange700"
254+
DEEP_ORANGE_800 = "deeporange800"
255+
DEEP_ORANGE_900 = "deeporange900"
256+
BROWN = "brown"
257+
BROWN_50 = "brown50"
258+
BROWN_100 = "brown100"
259+
BROWN_200 = "brown200"
260+
BROWN_300 = "brown300"
261+
BROWN_400 = "brown400"
262+
BROWN_500 = "brown500"
263+
BROWN_600 = "brown600"
264+
BROWN_700 = "brown700"
265+
BROWN_800 = "brown800"
266+
BROWN_900 = "brown900"
267+
BLUE_GREY = "bluegrey"
268+
BLUE_GREY_50 = "bluegrey50"
269+
BLUE_GREY_100 = "bluegrey100"
270+
BLUE_GREY_200 = "bluegrey200"
271+
BLUE_GREY_300 = "bluegrey300"
272+
BLUE_GREY_400 = "bluegrey400"
273+
BLUE_GREY_500 = "bluegrey500"
274+
BLUE_GREY_600 = "bluegrey600"
275+
BLUE_GREY_700 = "bluegrey700"
276+
BLUE_GREY_800 = "bluegrey800"
277+
BLUE_GREY_900 = "bluegrey900"
278+
RED_ACCENT = "redaccent"
279+
RED_ACCENT_100 = "redaccent100"
280+
RED_ACCENT_200 = "redaccent200"
281+
RED_ACCENT_400 = "redaccent400"
282+
RED_ACCENT_700 = "redaccent700"
283+
PINK_ACCENT = "pinkaccent"
284+
PINK_ACCENT_100 = "pinkaccent100"
285+
PINK_ACCENT_200 = "pinkaccent200"
286+
PINK_ACCENT_400 = "pinkaccent400"
287+
PINK_ACCENT_700 = "pinkaccent700"
288+
PURPLE_ACCENT = "purpleaccent"
289+
PURPLE_ACCENT_100 = "purpleaccent100"
290+
PURPLE_ACCENT_200 = "purpleaccent200"
291+
PURPLE_ACCENT_400 = "purpleaccent400"
292+
PURPLE_ACCENT_700 = "purpleaccent700"
293+
DEEP_PURPLE_ACCENT = "deeppurpleaccent"
294+
DEEP_PURPLE_ACCENT_100 = "deeppurpleaccent100"
295+
DEEP_PURPLE_ACCENT_200 = "deeppurpleaccent200"
296+
DEEP_PURPLE_ACCENT_400 = "deeppurpleaccent400"
297+
DEEP_PURPLE_ACCENT_700 = "deeppurpleaccent700"
298+
INDIGO_ACCENT = "indigoaccent"
299+
INDIGO_ACCENT_100 = "indigoaccent100"
300+
INDIGO_ACCENT_200 = "indigoaccent200"
301+
INDIGO_ACCENT_400 = "indigoaccent400"
302+
INDIGO_ACCENT_700 = "indigoaccent700"
303+
BLUE_ACCENT = "blueaccent"
304+
BLUE_ACCENT_100 = "blueaccent100"
305+
BLUE_ACCENT_200 = "blueaccent200"
306+
BLUE_ACCENT_400 = "blueaccent400"
307+
BLUE_ACCENT_700 = "blueaccent700"
308+
LIGHT_BLUE_ACCENT = "lightblueaccent"
309+
LIGHT_BLUE_ACCENT_100 = "lightblueaccent100"
310+
LIGHT_BLUE_ACCENT_200 = "lightblueaccent200"
311+
LIGHT_BLUE_ACCENT_400 = "lightblueaccent400"
312+
LIGHT_BLUE_ACCENT_700 = "lightblueaccent700"
313+
CYAN_ACCENT = "cyanaccent"
314+
CYAN_ACCENT_100 = "cyanaccent100"
315+
CYAN_ACCENT_200 = "cyanaccent200"
316+
CYAN_ACCENT_400 = "cyanaccent400"
317+
CYAN_ACCENT_700 = "cyanaccent700"
318+
TEAL_ACCENT = "tealaccent"
319+
TEAL_ACCENT_100 = "tealaccent100"
320+
TEAL_ACCENT_200 = "tealaccent200"
321+
TEAL_ACCENT_400 = "tealaccent400"
322+
TEAL_ACCENT_700 = "tealaccent700"
323+
GREEN_ACCENT = "greenaccent"
324+
GREEN_ACCENT_100 = "greenaccent100"
325+
GREEN_ACCENT_200 = "greenaccent200"
326+
GREEN_ACCENT_400 = "greenaccent400"
327+
GREEN_ACCENT_700 = "greenaccent700"
328+
LIGHT_GREEN_ACCENT = "lightgreenaccent"
329+
LIGHT_GREEN_ACCENT_100 = "lightgreenaccent100"
330+
LIGHT_GREEN_ACCENT_200 = "lightgreenaccent200"
331+
LIGHT_GREEN_ACCENT_400 = "lightgreenaccent400"
332+
LIGHT_GREEN_ACCENT_700 = "lightgreenaccent700"
333+
LIME_ACCENT = "limeaccent"
334+
LIME_ACCENT_100 = "limeaccent100"
335+
LIME_ACCENT_200 = "limeaccent200"
336+
LIME_ACCENT_400 = "limeaccent400"
337+
LIME_ACCENT_700 = "limeaccent700"
338+
YELLOW_ACCENT = "yellowaccent"
339+
YELLOW_ACCENT_100 = "yellowaccent100"
340+
YELLOW_ACCENT_200 = "yellowaccent200"
341+
YELLOW_ACCENT_400 = "yellowaccent400"
342+
YELLOW_ACCENT_700 = "yellowaccent700"
343+
AMBER_ACCENT = "amberaccent"
344+
AMBER_ACCENT_100 = "amberaccent100"
345+
AMBER_ACCENT_200 = "amberaccent200"
346+
AMBER_ACCENT_400 = "amberaccent400"
347+
AMBER_ACCENT_700 = "amberaccent700"
348+
ORANGE_ACCENT = "orangeaccent"
349+
ORANGE_ACCENT_100 = "orangeaccent100"
350+
ORANGE_ACCENT_200 = "orangeaccent200"
351+
ORANGE_ACCENT_400 = "orangeaccent400"
352+
ORANGE_ACCENT_700 = "orangeaccent700"
353+
DEEP_ORANGE_ACCENT = "deeporangeaccent"
354+
DEEP_ORANGE_ACCENT_100 = "deeporangeaccent100"
355+
DEEP_ORANGE_ACCENT_200 = "deeporangeaccent200"
356+
DEEP_ORANGE_ACCENT_400 = "deeporangeaccent400"
357+
DEEP_ORANGE_ACCENT_700 = "deeporangeaccent700"

sdk/python/playground/container-test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from time import sleep
55

66
import flet
7-
from flet import Page, alignment, border, border_radius, padding
7+
from flet import Page, alignment, border, border_radius, colors, padding
88
from flet.container import Container
99
from flet.text import Text
1010

@@ -22,10 +22,10 @@ def main(page: Page):
2222
margin=10,
2323
padding=10,
2424
alignment=alignment.Alignment(0.5, -0.5),
25-
bgcolor="amber",
25+
bgcolor=colors.AMBER,
2626
width=300,
2727
height=300,
28-
border=border.all(10, "pink"),
28+
border=border.all(10, colors.PINK_600),
2929
border_radius=border_radius.all(30),
3030
)
3131

0 commit comments

Comments
 (0)