Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththeme.py
More file actions
Latest commit
526 lines (449 loc) · 13.7 KB
/
Copy paththeme.py
File metadata and controls
526 lines (449 loc) · 13.7 KB
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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
fromdataclassesimportdataclass
fromenumimportEnum, IntFlag
fromtypingimportDict, List, Optional, Tuple, NamedTuple, Union
classImGuiCol(Enum):
Text=0
TextDisabled=1
WindowBg=2
ChildBg=3
PopupBg=4
Border=5
BorderShadow=6
FrameBg=7
FrameBgHovered=8
FrameBgActive=9
TitleBg=10
TitleBgActive=11
TitleBgCollapsed=12
MenuBarBg=13
ScrollbarBg=14
ScrollbarGrab=15
ScrollbarGrabHovered=16
ScrollbarGrabActive=17
CheckMark=18
SliderGrab=19
SliderGrabActive=20
Button=21
ButtonHovered=22
ButtonActive=23
Header=24
HeaderHovered=25
HeaderActive=26
Separator=27
SeparatorHovered=28
SeparatorActive=29
ResizeGrip=30
ResizeGripHovered=31
ResizeGripActive=32
Tab=33
TabHovered=34
TabActive=35
TabUnfocused=36
TabUnfocusedActive=37
PlotLines=38
PlotLinesHovered=39
PlotHistogram=40
PlotHistogramHovered=41
TableHeaderBg=42
TableBorderStrong=43
TableBorderLight=44
TableRowBg=45
TableRowBgAlt=46
TextSelectedBg=47
DragDropTarget=48
NavHighlight=49
NavWindowingHighlight=50
NavWindowingDimBg=51
ModalWindowDimBg=52
COUNT=53
def__str__(self):
returnself.value
classImPlotScale(Enum):
Linear=0
Time=1
Log10=2
SymLog=3
def__str__(self):
returnself.value
classImPlotMarker(Enum):
None_=-1
Circle=0
Square=1
Diamond=2
Up=3
Down=4
Left=5
Right=6
Cross=7
Plus=8
Asterisk=9
def__str__(self):
returnself.value
classImGuiStyleVar(Enum):
Alpha=0# float
DisabledAlpha=1# float
WindowPadding=2# ImVec2
WindowRounding=3# float
WindowBorderSize=4# float
WindowMinSize=5# ImVec2
WindowTitleAlign=6# ImVec2
ChildRounding=7# float
ChildBorderSize=8# float
PopupRounding=9# float
PopupBorderSize=10# float
FramePadding=11# ImVec2
FrameRounding=12# float
FrameBorderSize=13# float
ItemSpacing=14# ImVec2
ItemInnerSpacing=15# ImVec2
IndentSpacing=16# float
CellPadding=17# ImVec2
ScrollbarSize=18# float
ScrollbarRounding=19# float
GrabMinSize=20# float
GrabRounding=21# float
TabRounding=22# float
TabBorderSize=23# float
TabBarBorderSize=24# float
TableAngledHeadersAngle=25# float
TableAngledHeadersTextAlign=26# ImVec2
ButtonTextAlign=27# ImVec2
SelectableTextAlign=28# ImVec2
SeparatorTextBorderSize=29# float
SeparatorTextAlign=30# ImVec2
SeparatorTextPadding=31# ImVec2
def__str__(self):
returnself.value
classImGuiDir(Enum):
None_=-1
Left=0
Right=1
Up=2
Down=3
def__str__(self):
returnself.value
classImGuiHoveredFlags(IntFlag):
None_=0# "None" is a reserved keyword in Python
ChildWindows=1<<0
RootWindow=1<<1
AnyWindow=1<<2
NoPopupHierarchy=1<<3
# DockHierarchy = 1 << 4
AllowWhenBlockedByPopup=1<<5
# AllowWhenBlockedByModal = 1 << 6
AllowWhenBlockedByActiveItem=1<<7
AllowWhenOverlappedByItem=1<<8
AllowWhenOverlappedByWindow=1<<9
AllowWhenDisabled=1<<10
NoNavOverride=1<<11
AllowWhenOverlapped=AllowWhenOverlappedByItem|AllowWhenOverlappedByWindow
RectOnly=AllowWhenBlockedByPopup|AllowWhenBlockedByActiveItem|AllowWhenOverlapped
RootAndChildWindows=RootWindow|ChildWindows
ForTooltip=1<<12
Stationary=1<<13
DelayNone=1<<14
DelayShort=1<<15
DelayNormal=1<<16
NoSharedDelay=1<<17
def__str__(self):
returnself.value
HEXA=Tuple[str, float]
classFontDef(NamedTuple):
name: str
size: int
defto_dict(self):
return {
"name": self.name,
"size": self.size
}
classImVec2(NamedTuple):
x: float
y: float
defto_dict(self):
return {
"x": self.x,
"y": self.y
}
StyleColValue=Union[str, HEXA]
StyleVarValue=Union[float, ImVec2]
classAlign(Enum):
Left="left"
Right="right"
def__str__(self):
returnself.value
@dataclass
classStyleRules:
align: Optional[Align] =None
font: Optional[FontDef] =None
colors: Optional[Dict[ImGuiCol, StyleColValue]] =None
vars: Optional[Dict[ImGuiStyleVar, StyleVarValue]] =None
defto_dict(self):
out= {}
ifself.alignisnotNone:
out['align'] =self.align
ifself.fontisnotNone:
out['font'] =self.font.to_dict()
ifself.colorsisnotNone:
out['colors'] = {key: valueforkey, valueinself.colors.items()}
ifself.varsisnotNone:
out['vars'] = {key: valueforkey, valueinself.vars.items()}
returnout
classDirection(Enum):
Inherit="inherit"
Ltr="ltr"
Rtl="rtl"
def__str__(self):
returnself.value
classFlexDirection(Enum):
Column="column"
ColumnReverse="column-reverse"
Row="row"
RowReverse="row-reverse"
def__str__(self):
returnself.value
classJustifyContent(Enum):
FlexStart="flex-start"
Center="center"
FlexEnd="flex-end"
SpaceBetween="space-between"
SpaceAround="space-around"
SpaceEvenly="space-evenly"
def__str__(self):
returnself.value
classAlignContent(Enum):
Auto="auto"
FlexStart="flex-start"
Center="center"
FlexEnd="flex-end"
Stretch="stretch"
SpaceBetween="space-between"
SpaceAround="space-around"
SpaceEvenly="space-evenly"
def__str__(self):
returnself.value
classAlignItems(Enum):
Auto="auto"
FlexStart="flex-start"
Center="center"
FlexEnd="flex-end"
Stretch="stretch"
Baseline="baseline"
def__str__(self):
returnself.value
classAlignSelf(Enum):
Auto="auto"
FlexStart="flex-start"
Center="center"
FlexEnd="flex-end"
Stretch="stretch"
Baseline="baseline"
def__str__(self):
returnself.value
classPositionType(Enum):
Static="static"
Relative="relative"
Absolute="absolute"
def__str__(self):
returnself.value
classFlexWrap(Enum):
NoWrap="no-wrap"
Wrap="wrap"
WrapReverse="wrap-reverse"
def__str__(self):
returnself.value
classOverflow(Enum):
Visible="visible"
Hidden="hidden"
Scroll="scroll"
def__str__(self):
returnself.value
classDisplay(Enum):
Flex="flex"
DisplayNone="none"
def__str__(self):
returnself.value
classEdge(Enum):
Left="left"
Top="top"
Right="right"
Bottom="bottom"
Start="start"
End="end"
Horizontal="horizontal"
Vertical="vertical"
All="all"
def__str__(self):
returnself.value
classGutter(Enum):
Column="column"
Row="row"
All="all"
def__str__(self):
returnself.value
DimensionValue=Union[str, float]
classRoundCorners(Enum):
All="all"
TopLeft="topLeft"
TopRight="topRight"
BottomLeft="bottomLeft"
BottomRight="bottomRight"
def__str__(self):
returnself.value
@dataclass
classBorderStyle:
color: StyleColValue
thickness: Optional[float] =None
defto_dict(self):
out= {"color": self.color}
ifself.thickness:
out["thickness"] =self.thickness
returnout
@dataclass
classYogaStyle:
direction: Optional[Direction] =None
flexDirection: Optional[FlexDirection] =None
justifyContent: Optional[JustifyContent] =None
alignContent: Optional[AlignContent] =None
alignItems: Optional[AlignItems] =None
alignSelf: Optional[AlignSelf] =None
positionType: Optional[PositionType] =None
flexWrap: Optional[FlexWrap] =None
overflow: Optional[Overflow] =None
display: Optional[Display] =None
flex: Optional[float] =None
flexGrow: Optional[float] =None
flexShrink: Optional[float] =None
flexBasis: Optional[float] =None
flexBasisPercent: Optional[float] =None
position: Optional[Dict[Edge, float]] =None
margin: Optional[Dict[Edge, float]] =None
padding: Optional[Dict[Edge, float]] =None
gap: Optional[Dict[Gutter, float]] =None
aspectRatio: Optional[float] =None
width: Optional[Union[float, str]] =None
minWidth: Optional[Union[float, str]] =None
maxWidth: Optional[Union[float, str]] =None
height: Optional[Union[float, str]] =None
minHeight: Optional[Union[float, str]] =None
maxHeight: Optional[Union[float, str]] =None
defto_dict(self):
out= {}
ifself.directionisnotNone:
out['direction'] =self.direction
ifself.flexDirectionisnotNone:
out['flexDirection'] =self.flexDirection
ifself.justifyContentisnotNone:
out['justifyContent'] =self.justifyContent
ifself.alignContentisnotNone:
out['alignContent'] =self.alignContent
ifself.alignItemsisnotNone:
out['alignItems'] =self.alignItems
ifself.alignSelfisnotNone:
out['alignSelf'] =self.alignSelf
ifself.positionTypeisnotNone:
out['positionType'] =self.positionType
ifself.flexWrapisnotNone:
out['flexWrap'] =self.flexWrap
ifself.overflowisnotNone:
out['overflow'] =self.overflow
ifself.displayisnotNone:
out['display'] =self.display
ifself.flexisnotNone:
out['flex'] =self.flex
ifself.flexGrowisnotNone:
out['flexGrow'] =self.flexGrow
ifself.flexShrinkisnotNone:
out['flexShrink'] =self.flexShrink
ifself.flexBasisisnotNone:
out['flexBasis'] =self.flexBasis
ifself.flexBasisPercentisnotNone:
out['flexBasisPercent'] =self.flexBasisPercent
ifself.positionisnotNone:
out['position'] = {str(edge): valueforedge, valueinself.position.items()}
ifself.marginisnotNone:
out['margin'] = {str(edge): valueforedge, valueinself.margin.items()}
ifself.paddingisnotNone:
out['padding'] = {str(edge): valueforedge, valueinself.padding.items()}
ifself.gapisnotNone:
out['gap'] = {str(gutter): valueforgutter, valueinself.gap.items()}
ifself.aspectRatioisnotNone:
out['aspectRatio'] =self.aspectRatio
ifself.widthisnotNone:
out['width'] =self.width
ifself.minWidthisnotNone:
out['minWidth'] =self.minWidth
ifself.maxWidthisnotNone:
out['maxWidth'] =self.maxWidth
ifself.heightisnotNone:
out['height'] =self.height
ifself.minHeightisnotNone:
out['minHeight'] =self.minHeight
ifself.maxHeightisnotNone:
out['maxHeight'] =self.maxHeight
returnout
@dataclass
classBaseDrawStyle:
backgroundColor: Optional[StyleColValue] =None
border: Optional[BorderStyle] =None
borderTop: Optional[BorderStyle] =None
borderRight: Optional[BorderStyle] =None
borderBottom: Optional[BorderStyle] =None
borderLeft: Optional[BorderStyle] =None
rounding: Optional[float] =None
roundCorners: Optional[List[RoundCorners]] =None
defto_dict(self):
out= {}
ifself.backgroundColorisnotNone:
out['backgroundColor'] =self.backgroundColor
ifself.borderisnotNone:
out['border'] =self.border.to_dict()
ifself.borderTopisnotNone:
out['borderTop'] =self.borderTop.to_dict()
ifself.borderRightisnotNone:
out['borderRight'] =self.borderRight.to_dict()
ifself.borderBottomisnotNone:
out['borderBottom'] =self.borderBottom.to_dict()
ifself.borderLeftisnotNone:
out['borderLeft'] =self.borderLeft.to_dict()
ifself.roundingisnotNone:
out['rounding'] =self.rounding
ifself.roundCornersisnotNone:
out['roundCorners'] =self.roundCorners
returnout
@dataclass
classNodeStyleDef():
layout: Optional[YogaStyle] =None
base_draw: Optional[BaseDrawStyle] =None
defto_dict(self):
out= {}
ifself.layoutisnotNone:
out.update(self.layout.to_dict())
ifself.base_drawisnotNone:
out.update(self.base_draw.to_dict())
returnout
@dataclass
classWidgetStyleDef():
style_rules: Optional[StyleRules] =None
layout: Optional[YogaStyle] =None
base_draw: Optional[BaseDrawStyle] =None
defto_dict(self):
out= {}
ifself.style_rulesisnotNone:
out.update(self.style_rules.to_dict())
ifself.layoutisnotNone:
out.update(self.layout.to_dict())
ifself.base_drawisnotNone:
out.update(self.base_draw.to_dict())
returnout
@dataclass
classNodeStyle:
style: Optional[NodeStyleDef] =None
hoverStyle: Optional[NodeStyleDef] =None
activeStyle: Optional[NodeStyleDef] =None
disabledStyle: Optional[NodeStyleDef] =None
@dataclass
classWidgetStyle:
style: Optional[WidgetStyleDef] =None
hoverStyle: Optional[WidgetStyleDef] =None
activeStyle: Optional[WidgetStyleDef] =None
disabledStyle: Optional[WidgetStyleDef] =None