blender_theme 0.1.5

Blender Theme Model
Documentation
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
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
// SPDX-License-Identifier: GPL-3.0-or-later

pub mod types;

use core::fmt;
use std::{
    env, fs,
    path::{Path, PathBuf},
    str::FromStr,
};

use serde::{Deserialize, Serialize};
use xmlem::{
    display::{Config, EntityMode},
    Document,
};

pub use crate::types::{BackGroundType, Boolean, Factor, HexColor, Rgb};

#[derive(Clone, Debug, PartialEq)]
pub struct B3dTheme {
    pub bpy: Bpy,
    pub version: Version,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
#[serde(rename = "bpy")]
pub struct Bpy {
    pub theme: Theme,
    pub theme_style: ThemeStyle,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct Theme {
    pub user_interface: UserInterface,
    pub view_3d: View3d,
    pub graph_editor: GraphEditor,
    pub file_browser: FileBrowser,
    pub nla_editor: NlaEditor,
    pub dopesheet_editor: DopesheetEditor,
    pub image_editor: ImageEditor,
    pub sequence_editor: SequenceEditor,
    pub properties: Properties,
    pub text_editor: TextEditor,
    pub node_editor: NodeEditor,
    pub outliner: Outliner,
    pub info: Info,
    pub preferences: Preferences,
    pub console: Console,
    pub clip_editor: ClipEditor,
    pub topbar: Topbar,
    pub statusbar: Statusbar,
    pub spreadsheet: Spreadsheet,
    pub bone_color_sets: BoneColorSets,
    pub collection_color: CollectionColor,
    pub strip_color: StripColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct UserInterface {
    pub theme_user_interface: ThemeUserInterface,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeUserInterface {
    #[serde(rename = "@menu_shadow_fac")]
    pub menu_shadow_fac: Factor,
    #[serde(rename = "@menu_shadow_width")]
    pub menu_shadow_width: u8,
    #[serde(rename = "@icon_alpha")]
    pub icon_alpha: Factor,
    #[serde(rename = "@icon_saturation")]
    pub icon_saturation: Factor,
    #[serde(rename = "@widget_emboss")]
    pub widget_emboss: HexColor,
    #[serde(
        rename = "@editor_border",
        skip_serializing_if = "Option::is_none"
    )]
    pub editor_border: Option<HexColor>,
    #[serde(rename = "@editor_outline")]
    pub editor_outline: HexColor,
    #[serde(
        rename = "@editor_outline_active",
        skip_serializing_if = "Option::is_none"
    )]
    pub editor_outline_active: Option<HexColor>,
    #[serde(rename = "@widget_text_cursor")]
    pub widget_text_cursor: HexColor,
    #[serde(rename = "@panel_roundness")]
    pub panel_roundness: Factor,
    #[serde(rename = "@transparent_checker_primary")]
    pub transparent_checker_primary: HexColor,
    #[serde(rename = "@transparent_checker_secondary")]
    pub transparent_checker_secondary: HexColor,
    #[serde(rename = "@transparent_checker_size")]
    pub transparent_checker_size: u8,
    #[serde(rename = "@axis_x")]
    pub axis_x: HexColor,
    #[serde(rename = "@axis_y")]
    pub axis_y: HexColor,
    #[serde(rename = "@axis_z")]
    pub axis_z: HexColor,
    #[serde(rename = "@gizmo_hi")]
    pub gizmo_hi: HexColor,
    #[serde(rename = "@gizmo_primary")]
    pub gizmo_primary: HexColor,
    #[serde(rename = "@gizmo_secondary")]
    pub gizmo_secondary: HexColor,
    #[serde(rename = "@gizmo_view_align")]
    pub gizmo_view_align: HexColor,
    #[serde(rename = "@gizmo_a")]
    pub gizmo_a: HexColor,
    #[serde(rename = "@gizmo_b")]
    pub gizmo_b: HexColor,
    #[serde(rename = "@icon_scene")]
    pub icon_scene: HexColor,
    #[serde(rename = "@icon_collection")]
    pub icon_collection: HexColor,
    #[serde(rename = "@icon_object")]
    pub icon_object: HexColor,
    #[serde(rename = "@icon_object_data")]
    pub icon_object_data: HexColor,
    #[serde(rename = "@icon_modifier")]
    pub icon_modifier: HexColor,
    #[serde(rename = "@icon_shading")]
    pub icon_shading: HexColor,
    #[serde(rename = "@icon_folder")]
    pub icon_folder: HexColor,
    #[serde(rename = "@icon_autokey", skip_serializing_if = "Option::is_none")]
    pub icon_autokey: Option<HexColor>,
    #[serde(rename = "@icon_border_intensity")]
    pub icon_border_intensity: Factor,
    pub wcol_regular: WcolRegular,
    pub wcol_tool: WcolTool,
    pub wcol_toolbar_item: WcolToolbarItem,
    pub wcol_radio: WcolRadio,
    pub wcol_text: WcolText,
    pub wcol_option: WcolOption,
    pub wcol_toggle: WcolToggle,
    pub wcol_num: WcolNum,
    pub wcol_numslider: WcolNumslider,
    pub wcol_box: WcolBox,
    pub wcol_menu: WcolMenu,
    pub wcol_pulldown: WcolPulldown,
    pub wcol_menu_back: WcolMenuBack,
    pub wcol_pie_menu: WcolPieMenu,
    pub wcol_tooltip: WcolTooltip,
    pub wcol_menu_item: WcolMenuItem,
    pub wcol_scroll: WcolScroll,
    pub wcol_progress: WcolProgress,
    pub wcol_list_item: WcolListItem,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub wcol_view_item: Option<WcolViewItem>,
    pub wcol_state: WcolState,
    pub wcol_tab: WcolTab,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolRegular {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolTool {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolToolbarItem {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolRadio {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolText {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolOption {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolToggle {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolNum {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolNumslider {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolBox {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolMenu {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolPulldown {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolMenuBack {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolPieMenu {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolTooltip {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolMenuItem {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolScroll {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolProgress {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolListItem {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolViewItem {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolState {
    pub theme_widget_state_colors: ThemeWidgetStateColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WcolTab {
    pub theme_widget_colors: ThemeWidgetColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeWidgetColors {
    #[serde(rename = "@outline")]
    pub outline: HexColor,
    #[serde(rename = "@inner")]
    pub inner: HexColor,
    #[serde(rename = "@inner_sel")]
    pub inner_sel: HexColor,
    #[serde(rename = "@item")]
    pub item: HexColor,
    #[serde(rename = "@text")]
    pub text: HexColor,
    #[serde(rename = "@text_sel")]
    pub text_sel: HexColor,
    #[serde(rename = "@show_shaded")]
    pub show_shaded: Boolean,
    #[serde(rename = "@shadetop")]
    pub shadetop: u8,
    #[serde(rename = "@shadedown")]
    pub shadedown: u8,
    #[serde(rename = "@roundness")]
    pub roundness: Factor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeWidgetStateColors {
    #[serde(rename = "@inner_anim")]
    pub inner_anim: HexColor,
    #[serde(rename = "@inner_anim_sel")]
    pub inner_anim_sel: HexColor,
    #[serde(rename = "@inner_key")]
    pub inner_key: HexColor,
    #[serde(rename = "@inner_key_sel")]
    pub inner_key_sel: HexColor,
    #[serde(rename = "@inner_driven")]
    pub inner_driven: HexColor,
    #[serde(rename = "@inner_driven_sel")]
    pub inner_driven_sel: HexColor,
    #[serde(rename = "@inner_overridden")]
    pub inner_overridden: HexColor,
    #[serde(rename = "@inner_overridden_sel")]
    pub inner_overridden_sel: HexColor,
    #[serde(rename = "@inner_changed")]
    pub inner_changed: HexColor,
    #[serde(rename = "@inner_changed_sel")]
    pub inner_changed_sel: HexColor,
    #[serde(rename = "@blend")]
    pub blend: Factor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct View3d {
    pub theme_view_3_d: ThemeView3D,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeView3D {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@clipping_border_3d")]
    pub clipping_border_3d: HexColor,
    #[serde(rename = "@wire")]
    pub wire: HexColor,
    #[serde(rename = "@wire_edit")]
    pub wire_edit: HexColor,
    #[serde(rename = "@edge_width")]
    pub edge_width: u8,
    #[serde(rename = "@gp_vertex")]
    pub gp_vertex: HexColor,
    #[serde(rename = "@gp_vertex_select")]
    pub gp_vertex_select: HexColor,
    #[serde(rename = "@gp_vertex_size")]
    pub gp_vertex_size: u8,
    #[serde(rename = "@text_grease_pencil")]
    pub text_grease_pencil: HexColor,
    #[serde(rename = "@object_selected")]
    pub object_selected: HexColor,
    #[serde(rename = "@object_active")]
    pub object_active: HexColor,
    #[serde(rename = "@text_keyframe")]
    pub text_keyframe: HexColor,
    #[serde(rename = "@camera")]
    pub camera: HexColor,
    #[serde(rename = "@empty")]
    pub empty: HexColor,
    #[serde(rename = "@light")]
    pub light: HexColor,
    #[serde(rename = "@speaker")]
    pub speaker: HexColor,
    #[serde(rename = "@vertex")]
    pub vertex: HexColor,
    #[serde(rename = "@vertex_select")]
    pub vertex_select: HexColor,
    #[serde(
        rename = "@vertex_active",
        skip_serializing_if = "Option::is_none"
    )]
    pub vertex_active: Option<HexColor>,
    #[serde(rename = "@vertex_size")]
    pub vertex_size: u8,
    #[serde(rename = "@vertex_bevel")]
    pub vertex_bevel: HexColor,
    #[serde(rename = "@vertex_unreferenced")]
    pub vertex_unreferenced: HexColor,
    #[serde(rename = "@edge_select")]
    pub edge_select: HexColor,
    #[serde(
        rename = "@edge_mode_select",
        skip_serializing_if = "Option::is_none"
    )]
    pub edge_mode_select: Option<HexColor>,
    #[serde(rename = "@edge_seam")]
    pub edge_seam: HexColor,
    #[serde(rename = "@edge_sharp")]
    pub edge_sharp: HexColor,
    #[serde(rename = "@edge_crease")]
    pub edge_crease: HexColor,
    #[serde(rename = "@edge_bevel")]
    pub edge_bevel: HexColor,
    #[serde(rename = "@edge_facesel")]
    pub edge_facesel: HexColor,
    #[serde(rename = "@freestyle_edge_mark")]
    pub freestyle_edge_mark: HexColor,
    #[serde(rename = "@face")]
    pub face: HexColor,
    #[serde(rename = "@face_select")]
    pub face_select: HexColor,
    #[serde(
        rename = "@face_mode_select",
        skip_serializing_if = "Option::is_none"
    )]
    pub face_mode_select: Option<HexColor>,
    #[serde(rename = "@face_dot")]
    pub face_dot: HexColor,
    #[serde(rename = "@facedot_size")]
    pub facedot_size: u8,
    #[serde(rename = "@freestyle_face_mark")]
    pub freestyle_face_mark: HexColor,
    #[serde(rename = "@face_retopology")]
    pub face_retopology: HexColor,
    #[serde(rename = "@face_back")]
    pub face_back: HexColor,
    #[serde(rename = "@face_front")]
    pub face_front: HexColor,
    #[serde(rename = "@nurb_uline")]
    pub nurb_uline: HexColor,
    #[serde(rename = "@nurb_vline")]
    pub nurb_vline: HexColor,
    #[serde(rename = "@nurb_sel_uline")]
    pub nurb_sel_uline: HexColor,
    #[serde(rename = "@nurb_sel_vline")]
    pub nurb_sel_vline: HexColor,
    #[serde(rename = "@act_spline")]
    pub act_spline: HexColor,
    #[serde(rename = "@handle_free")]
    pub handle_free: HexColor,
    #[serde(rename = "@handle_auto")]
    pub handle_auto: HexColor,
    #[serde(rename = "@handle_vect")]
    pub handle_vect: HexColor,
    #[serde(rename = "@handle_sel_vect")]
    pub handle_sel_vect: HexColor,
    #[serde(rename = "@handle_align")]
    pub handle_align: HexColor,
    #[serde(rename = "@handle_sel_free")]
    pub handle_sel_free: HexColor,
    #[serde(rename = "@handle_sel_auto")]
    pub handle_sel_auto: HexColor,
    #[serde(rename = "@handle_sel_align")]
    pub handle_sel_align: HexColor,
    #[serde(rename = "@lastsel_point")]
    pub lastsel_point: HexColor,
    #[serde(rename = "@extra_edge_len")]
    pub extra_edge_len: HexColor,
    #[serde(rename = "@extra_edge_angle")]
    pub extra_edge_angle: HexColor,
    #[serde(rename = "@extra_face_angle")]
    pub extra_face_angle: HexColor,
    #[serde(rename = "@extra_face_area")]
    pub extra_face_area: HexColor,
    #[serde(rename = "@editmesh_active")]
    pub editmesh_active: HexColor,
    #[serde(rename = "@normal")]
    pub normal: HexColor,
    #[serde(rename = "@vertex_normal")]
    pub vertex_normal: HexColor,
    #[serde(rename = "@split_normal")]
    pub split_normal: HexColor,
    #[serde(rename = "@bone_pose")]
    pub bone_pose: HexColor,
    #[serde(rename = "@bone_pose_active")]
    pub bone_pose_active: HexColor,
    #[serde(rename = "@bone_solid")]
    pub bone_solid: HexColor,
    #[serde(rename = "@bone_locked_weight")]
    pub bone_locked_weight: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(
        rename = "@before_current_frame",
        skip_serializing_if = "Option::is_none"
    )]
    pub before_frame_current: Option<HexColor>,
    #[serde(
        rename = "@after_current_frame",
        skip_serializing_if = "Option::is_none"
    )]
    pub after_frame_current: Option<HexColor>,
    #[serde(rename = "@bundle_solid")]
    pub bundle_solid: HexColor,
    #[serde(rename = "@camera_path")]
    pub camera_path: HexColor,
    #[serde(rename = "@camera_passepartout")]
    pub camera_passepartout: HexColor,
    #[serde(rename = "@skin_root")]
    pub skin_root: HexColor,
    #[serde(rename = "@view_overlay")]
    pub view_overlay: HexColor,
    #[serde(rename = "@transform")]
    pub transform: HexColor,
    #[serde(rename = "@paint_curve_handle")]
    pub paint_curve_handle: HexColor,
    #[serde(rename = "@paint_curve_pivot")]
    pub paint_curve_pivot: HexColor,
    #[serde(rename = "@outline_width")]
    pub outline_width: u8,
    #[serde(rename = "@object_origin_size")]
    pub object_origin_size: u8,
    pub space: Space,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub asset_shelf: Option<AssetShelf>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct SpaceGradient {
    pub theme_space_gradient: ThemeSpaceGradient,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct AssetShelf {
    pub theme_asset_shelf: ThemeAssetShelf,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeAssetShelf {
    #[serde(rename = "@header_back")]
    pub header_back: HexColor,
    #[serde(rename = "@back")]
    pub back: HexColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct GraphEditor {
    pub theme_graph_editor: ThemeGraphEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeGraphEditor {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(rename = "@time_scrub_background")]
    pub time_scrub_background: HexColor,
    #[serde(rename = "@time_marker_line")]
    pub time_marker_line: HexColor,
    #[serde(rename = "@time_marker_line_selected")]
    pub time_marker_line_selected: HexColor,
    #[serde(rename = "@window_sliders")]
    pub window_sliders: HexColor,
    #[serde(rename = "@channels_region")]
    pub channels_region: HexColor,
    #[serde(rename = "@dopesheet_channel")]
    pub dopesheet_channel: HexColor,
    #[serde(rename = "@dopesheet_subchannel")]
    pub dopesheet_subchannel: HexColor,
    #[serde(rename = "@channel_group")]
    pub channel_group: HexColor,
    #[serde(rename = "@active_channels_group")]
    pub active_channels_group: HexColor,
    #[serde(rename = "@preview_range")]
    pub preview_range: HexColor,
    #[serde(rename = "@vertex")]
    pub vertex: HexColor,
    #[serde(rename = "@vertex_select")]
    pub vertex_select: HexColor,
    #[serde(rename = "@vertex_active")]
    pub vertex_active: HexColor,
    #[serde(rename = "@vertex_size")]
    pub vertex_size: u8,
    #[serde(rename = "@vertex_bevel")]
    pub vertex_bevel: HexColor,
    #[serde(rename = "@vertex_unreferenced")]
    pub vertex_unreferenced: HexColor,
    #[serde(rename = "@handle_free")]
    pub handle_free: HexColor,
    #[serde(rename = "@handle_auto")]
    pub handle_auto: HexColor,
    #[serde(rename = "@handle_vect")]
    pub handle_vect: HexColor,
    #[serde(rename = "@handle_sel_vect")]
    pub handle_sel_vect: HexColor,
    #[serde(rename = "@handle_align")]
    pub handle_align: HexColor,
    #[serde(rename = "@handle_sel_free")]
    pub handle_sel_free: HexColor,
    #[serde(rename = "@handle_sel_auto")]
    pub handle_sel_auto: HexColor,
    #[serde(rename = "@handle_sel_align")]
    pub handle_sel_align: HexColor,
    #[serde(rename = "@handle_auto_clamped")]
    pub handle_auto_clamped: HexColor,
    #[serde(rename = "@handle_sel_auto_clamped")]
    pub handle_sel_auto_clamped: HexColor,
    #[serde(rename = "@lastsel_point")]
    pub lastsel_point: HexColor,
    #[serde(rename = "@handle_vertex")]
    pub handle_vertex: HexColor,
    #[serde(rename = "@handle_vertex_select")]
    pub handle_vertex_select: HexColor,
    #[serde(rename = "@handle_vertex_size")]
    pub handle_vertex_size: u8,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct FileBrowser {
    pub theme_file_browser: ThemeFileBrowser,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeFileBrowser {
    #[serde(rename = "@selected_file")]
    pub selected_file: HexColor,
    #[serde(rename = "@row_alternate")]
    pub row_alternate: HexColor,
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct NlaEditor {
    pub theme_n_l_a_editor: ThemeNLAEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeNLAEditor {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@view_sliders")]
    pub view_sliders: HexColor,
    #[serde(rename = "@dopesheet_channel")]
    pub dopesheet_channel: HexColor,
    #[serde(
        rename = "@dopesheet_subchannel",
        skip_serializing_if = "Option::is_none"
    )]
    pub dopesheet_subchannel: Option<HexColor>,
    #[serde(rename = "@nla_track")]
    pub nla_track: HexColor,
    #[serde(rename = "@active_action")]
    pub active_action: HexColor,
    #[serde(rename = "@active_action_unset")]
    pub active_action_unset: HexColor,
    #[serde(rename = "@preview_range")]
    pub preview_range: HexColor,
    #[serde(rename = "@strips")]
    pub strips: HexColor,
    #[serde(rename = "@strips_selected")]
    pub strips_selected: HexColor,
    #[serde(rename = "@transition_strips")]
    pub transition_strips: HexColor,
    #[serde(rename = "@transition_strips_selected")]
    pub transition_strips_selected: HexColor,
    #[serde(rename = "@meta_strips")]
    pub meta_strips: HexColor,
    #[serde(rename = "@meta_strips_selected")]
    pub meta_strips_selected: HexColor,
    #[serde(rename = "@sound_strips")]
    pub sound_strips: HexColor,
    #[serde(rename = "@sound_strips_selected")]
    pub sound_strips_selected: HexColor,
    #[serde(rename = "@tweak")]
    pub tweak: HexColor,
    #[serde(rename = "@tweak_duplicate")]
    pub tweak_duplicate: HexColor,
    #[serde(rename = "@keyframe_border")]
    pub keyframe_border: HexColor,
    #[serde(rename = "@keyframe_border_selected")]
    pub keyframe_border_selected: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(rename = "@time_scrub_background")]
    pub time_scrub_background: HexColor,
    #[serde(rename = "@time_marker_line")]
    pub time_marker_line: HexColor,
    #[serde(rename = "@time_marker_line_selected")]
    pub time_marker_line_selected: HexColor,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct DopesheetEditor {
    pub theme_dope_sheet: ThemeDopeSheet,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeDopeSheet {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(rename = "@time_scrub_background")]
    pub time_scrub_background: HexColor,
    #[serde(rename = "@time_marker_line")]
    pub time_marker_line: HexColor,
    #[serde(rename = "@time_marker_line_selected")]
    pub time_marker_line_selected: HexColor,
    #[serde(rename = "@value_sliders")]
    pub value_sliders: HexColor,
    #[serde(rename = "@view_sliders")]
    pub view_sliders: HexColor,
    #[serde(rename = "@dopesheet_channel")]
    pub dopesheet_channel: HexColor,
    #[serde(rename = "@dopesheet_subchannel")]
    pub dopesheet_subchannel: HexColor,
    #[serde(rename = "@channels")]
    pub channels: HexColor,
    #[serde(rename = "@channels_selected")]
    pub channels_selected: HexColor,
    #[serde(rename = "@channel_group")]
    pub channel_group: HexColor,
    #[serde(rename = "@active_channels_group")]
    pub active_channels_group: HexColor,
    #[serde(rename = "@long_key")]
    pub long_key: HexColor,
    #[serde(rename = "@long_key_selected")]
    pub long_key_selected: HexColor,
    #[serde(rename = "@keyframe")]
    pub keyframe: HexColor,
    #[serde(rename = "@keyframe_selected")]
    pub keyframe_selected: HexColor,
    #[serde(rename = "@keyframe_extreme")]
    pub keyframe_extreme: HexColor,
    #[serde(rename = "@keyframe_extreme_selected")]
    pub keyframe_extreme_selected: HexColor,
    #[serde(rename = "@keyframe_breakdown")]
    pub keyframe_breakdown: HexColor,
    #[serde(rename = "@keyframe_breakdown_selected")]
    pub keyframe_breakdown_selected: HexColor,
    #[serde(rename = "@keyframe_jitter")]
    pub keyframe_jitter: HexColor,
    #[serde(rename = "@keyframe_jitter_selected")]
    pub keyframe_jitter_selected: HexColor,
    #[serde(rename = "@keyframe_movehold")]
    pub keyframe_movehold: HexColor,
    #[serde(rename = "@keyframe_movehold_selected")]
    pub keyframe_movehold_selected: HexColor,
    #[serde(
        rename = "@keyframe_generated",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_generated: Option<HexColor>,
    #[serde(
        rename = "@keyframe_generated_selected",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_generated_selected: Option<HexColor>,
    #[serde(rename = "@keyframe_border")]
    pub keyframe_border: HexColor,
    #[serde(rename = "@keyframe_border_selected")]
    pub keyframe_border_selected: HexColor,
    #[serde(rename = "@keyframe_scale_factor")]
    pub keyframe_scale_factor: f32,
    #[serde(rename = "@summary")]
    pub summary: HexColor,
    #[serde(rename = "@preview_range")]
    pub preview_range: HexColor,
    #[serde(rename = "@interpolation_line")]
    pub interpolation_line: HexColor,
    #[serde(rename = "@simulated_frames")]
    pub simulated_frames: HexColor,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct ImageEditor {
    pub theme_image_editor: ThemeImageEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeImageEditor {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@vertex")]
    pub vertex: HexColor,
    #[serde(rename = "@vertex_select")]
    pub vertex_select: HexColor,
    #[serde(
        rename = "@vertex_active",
        skip_serializing_if = "Option::is_none"
    )]
    pub vertex_active: Option<HexColor>,
    #[serde(rename = "@vertex_size")]
    pub vertex_size: u8,
    #[serde(rename = "@vertex_bevel")]
    pub vertex_bevel: HexColor,
    #[serde(rename = "@vertex_unreferenced")]
    pub vertex_unreferenced: HexColor,
    #[serde(rename = "@face")]
    pub face: HexColor,
    #[serde(rename = "@face_select")]
    pub face_select: HexColor,
    #[serde(
        rename = "@face_mode_select",
        skip_serializing_if = "Option::is_none"
    )]
    pub face_mode_select: Option<HexColor>,
    #[serde(rename = "@face_dot")]
    pub face_dot: HexColor,
    #[serde(rename = "@facedot_size")]
    pub facedot_size: u8,
    #[serde(rename = "@freestyle_face_mark")]
    pub freestyle_face_mark: HexColor,
    #[serde(rename = "@face_retopology")]
    pub face_retopology: HexColor,
    #[serde(rename = "@face_back")]
    pub face_back: HexColor,
    #[serde(rename = "@face_front")]
    pub face_front: HexColor,
    #[serde(rename = "@editmesh_active")]
    pub editmesh_active: HexColor,
    #[serde(rename = "@wire_edit")]
    pub wire_edit: HexColor,
    #[serde(rename = "@edge_width")]
    pub edge_width: u8,
    #[serde(rename = "@edge_select")]
    pub edge_select: HexColor,
    #[serde(rename = "@scope_back")]
    pub scope_back: HexColor,
    #[serde(rename = "@preview_stitch_face")]
    pub preview_stitch_face: HexColor,
    #[serde(rename = "@preview_stitch_edge")]
    pub preview_stitch_edge: HexColor,
    #[serde(rename = "@preview_stitch_vert")]
    pub preview_stitch_vert: HexColor,
    #[serde(rename = "@preview_stitch_stitchable")]
    pub preview_stitch_stitchable: HexColor,
    #[serde(rename = "@preview_stitch_unstitchable")]
    pub preview_stitch_unstitchable: HexColor,
    #[serde(rename = "@preview_stitch_active")]
    pub preview_stitch_active: HexColor,
    #[serde(rename = "@uv_shadow")]
    pub uv_shadow: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(rename = "@metadatabg")]
    pub metadatabg: HexColor,
    #[serde(rename = "@metadatatext")]
    pub metadatatext: HexColor,
    #[serde(rename = "@handle_free")]
    pub handle_free: HexColor,
    #[serde(rename = "@handle_auto")]
    pub handle_auto: HexColor,
    #[serde(rename = "@handle_align")]
    pub handle_align: HexColor,
    #[serde(rename = "@handle_sel_free")]
    pub handle_sel_free: HexColor,
    #[serde(rename = "@handle_sel_auto")]
    pub handle_sel_auto: HexColor,
    #[serde(rename = "@handle_sel_align")]
    pub handle_sel_align: HexColor,
    #[serde(rename = "@handle_auto_clamped")]
    pub handle_auto_clamped: HexColor,
    #[serde(rename = "@handle_sel_auto_clamped")]
    pub handle_sel_auto_clamped: HexColor,
    #[serde(rename = "@handle_vertex")]
    pub handle_vertex: HexColor,
    #[serde(rename = "@handle_vertex_select")]
    pub handle_vertex_select: HexColor,
    #[serde(rename = "@handle_vertex_size")]
    pub handle_vertex_size: u8,
    #[serde(rename = "@paint_curve_handle")]
    pub paint_curve_handle: HexColor,
    #[serde(rename = "@paint_curve_pivot")]
    pub paint_curve_pivot: HexColor,
    pub space: Space,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub asset_shelf: Option<AssetShelf>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct SequenceEditor {
    pub theme_sequence_editor: ThemeSequenceEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeSequenceEditor {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@window_sliders")]
    pub window_sliders: HexColor,
    #[serde(rename = "@movie_strip")]
    pub movie_strip: HexColor,
    #[serde(rename = "@movieclip_strip")]
    pub movieclip_strip: HexColor,
    #[serde(rename = "@image_strip")]
    pub image_strip: HexColor,
    #[serde(rename = "@scene_strip")]
    pub scene_strip: HexColor,
    #[serde(rename = "@audio_strip")]
    pub audio_strip: HexColor,
    #[serde(rename = "@effect_strip")]
    pub effect_strip: HexColor,
    #[serde(
        rename = "@transition_strip",
        skip_serializing_if = "Option::is_none"
    )]
    pub transition_strip: Option<HexColor>,
    #[serde(rename = "@color_strip")]
    pub color_strip: HexColor,
    #[serde(rename = "@meta_strip")]
    pub meta_strip: HexColor,
    #[serde(rename = "@mask_strip")]
    pub mask_strip: HexColor,
    #[serde(rename = "@text_strip")]
    pub text_strip: HexColor,
    #[serde(rename = "@active_strip")]
    pub active_strip: HexColor,
    #[serde(rename = "@selected_strip")]
    pub selected_strip: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(rename = "@time_scrub_background")]
    pub time_scrub_background: HexColor,
    #[serde(rename = "@time_marker_line")]
    pub time_marker_line: HexColor,
    #[serde(rename = "@time_marker_line_selected")]
    pub time_marker_line_selected: HexColor,
    #[serde(rename = "@keyframe")]
    pub keyframe: HexColor,
    #[serde(
        rename = "@keyframe_selected",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_selected: Option<HexColor>,
    #[serde(
        rename = "@keyframe_breakdown",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_breakdown: Option<HexColor>,
    #[serde(
        rename = "@keyframe_breakdown_selected",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_breakdown_selected: Option<HexColor>,
    #[serde(
        rename = "@keyframe_movehold",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_movehold: Option<HexColor>,
    #[serde(
        rename = "@keyframe_movehold_selected",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_movehold_selected: Option<HexColor>,
    #[serde(
        rename = "@keyframe_generated",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_generated: Option<HexColor>,
    #[serde(
        rename = "@keyframe_generated_selected",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_generated_selected: Option<HexColor>,
    #[serde(
        rename = "@keyframe_border",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_border: Option<HexColor>,
    #[serde(
        rename = "@keyframe_border_selected",
        skip_serializing_if = "Option::is_none"
    )]
    pub keyframe_border_selected: Option<HexColor>,
    #[serde(rename = "@draw_action")]
    pub draw_action: HexColor,
    #[serde(rename = "@preview_back")]
    pub preview_back: HexColor,
    #[serde(rename = "@metadatabg")]
    pub metadatabg: HexColor,
    #[serde(rename = "@metadatatext")]
    pub metadatatext: HexColor,
    #[serde(rename = "@preview_range")]
    pub preview_range: HexColor,
    #[serde(rename = "@row_alternate")]
    pub row_alternate: HexColor,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Properties {
    pub theme_properties: ThemeProperties,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeProperties {
    #[serde(rename = "@match")]
    pub r#match: HexColor,
    #[serde(rename = "@active_modifier")]
    pub active_modifier: HexColor,
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct TextEditor {
    pub theme_text_editor: ThemeTextEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeTextEditor {
    #[serde(rename = "@line_numbers")]
    pub line_numbers: HexColor,
    #[serde(rename = "@line_numbers_background")]
    pub line_numbers_background: HexColor,
    #[serde(rename = "@selected_text")]
    pub selected_text: HexColor,
    #[serde(rename = "@cursor")]
    pub cursor: HexColor,
    #[serde(rename = "@syntax_builtin")]
    pub syntax_builtin: HexColor,
    #[serde(rename = "@syntax_symbols")]
    pub syntax_symbols: HexColor,
    #[serde(rename = "@syntax_special")]
    pub syntax_special: HexColor,
    #[serde(rename = "@syntax_preprocessor")]
    pub syntax_preprocessor: HexColor,
    #[serde(rename = "@syntax_reserved")]
    pub syntax_reserved: HexColor,
    #[serde(rename = "@syntax_comment")]
    pub syntax_comment: HexColor,
    #[serde(rename = "@syntax_string")]
    pub syntax_string: HexColor,
    #[serde(rename = "@syntax_numbers")]
    pub syntax_numbers: HexColor,
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct NodeEditor {
    pub theme_node_editor: ThemeNodeEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeNodeEditor {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@node_selected")]
    pub node_selected: HexColor,
    #[serde(rename = "@node_active")]
    pub node_active: HexColor,
    #[serde(rename = "@wire")]
    pub wire: HexColor,
    #[serde(rename = "@wire_inner")]
    pub wire_inner: HexColor,
    #[serde(rename = "@wire_select")]
    pub wire_select: HexColor,
    #[serde(rename = "@selected_text")]
    pub selected_text: HexColor,
    #[serde(rename = "@node_backdrop")]
    pub node_backdrop: HexColor,
    #[serde(rename = "@converter_node")]
    pub converter_node: HexColor,
    #[serde(rename = "@color_node")]
    pub color_node: HexColor,
    #[serde(rename = "@group_node")]
    pub group_node: HexColor,
    #[serde(rename = "@group_socket_node")]
    pub group_socket_node: HexColor,
    #[serde(rename = "@frame_node")]
    pub frame_node: HexColor,
    #[serde(rename = "@matte_node")]
    pub matte_node: HexColor,
    #[serde(rename = "@distor_node")]
    pub distor_node: HexColor,
    #[serde(rename = "@noodle_curving")]
    pub noodle_curving: u8,
    #[serde(rename = "@grid_levels")]
    pub grid_levels: u8,
    #[serde(rename = "@dash_alpha")]
    pub dash_alpha: Factor,
    #[serde(rename = "@input_node")]
    pub input_node: HexColor,
    #[serde(rename = "@output_node")]
    pub output_node: HexColor,
    #[serde(rename = "@filter_node")]
    pub filter_node: HexColor,
    #[serde(rename = "@vector_node")]
    pub vector_node: HexColor,
    #[serde(rename = "@texture_node")]
    pub texture_node: HexColor,
    #[serde(rename = "@shader_node")]
    pub shader_node: HexColor,
    #[serde(rename = "@script_node")]
    pub script_node: HexColor,
    #[serde(rename = "@pattern_node")]
    pub pattern_node: HexColor,
    #[serde(rename = "@layout_node")]
    pub layout_node: HexColor,
    #[serde(rename = "@geometry_node")]
    pub geometry_node: HexColor,
    #[serde(rename = "@attribute_node")]
    pub attribute_node: HexColor,
    #[serde(rename = "@simulation_zone")]
    pub simulation_zone: HexColor,
    #[serde(rename = "@repeat_zone", skip_serializing_if = "Option::is_none")]
    pub repeat_zone: Option<HexColor>,
    #[serde(
        rename = "@foreach_geometry_element_zone",
        skip_serializing_if = "Option::is_none"
    )]
    pub foreach_geometry_element_zone: Option<HexColor>,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Outliner {
    pub theme_outliner: ThemeOutliner,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeOutliner {
    #[serde(rename = "@match")]
    r#match: HexColor,
    #[serde(rename = "@selected_highlight")]
    selected_highlight: HexColor,
    #[serde(rename = "@active")]
    active: HexColor,
    #[serde(rename = "@selected_object")]
    selected_object: HexColor,
    #[serde(rename = "@active_object")]
    active_object: HexColor,
    #[serde(rename = "@edited_object")]
    edited_object: HexColor,
    #[serde(rename = "@row_alternate")]
    row_alternate: HexColor,
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Info {
    theme_info: ThemeInfo,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeInfo {
    #[serde(rename = "@info_selected")]
    info_selected: HexColor,
    #[serde(rename = "@info_selected_text")]
    info_selected_text: HexColor,
    #[serde(rename = "@info_error")]
    info_error: HexColor,
    #[serde(rename = "@info_error_text")]
    info_error_text: HexColor,
    #[serde(rename = "@info_warning")]
    info_warning: HexColor,
    #[serde(rename = "@info_warning_text")]
    info_warning_text: HexColor,
    #[serde(rename = "@info_info")]
    info_info: HexColor,
    #[serde(rename = "@info_info_text")]
    info_info_text: HexColor,
    #[serde(rename = "@info_debug")]
    info_debug: HexColor,
    #[serde(rename = "@info_debug_text")]
    info_debug_text: HexColor,
    #[serde(rename = "@info_property")]
    info_property: HexColor,
    #[serde(rename = "@info_property_text")]
    info_property_text: HexColor,
    #[serde(rename = "@info_operator")]
    info_operator: HexColor,
    #[serde(rename = "@info_operator_text")]
    info_operator_text: HexColor,
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Preferences {
    pub theme_preferences: ThemePreferences,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemePreferences {
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Console {
    pub theme_console: ThemeConsole,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeConsole {
    #[serde(rename = "@line_output")]
    line_output: HexColor,
    #[serde(rename = "@line_input")]
    line_input: HexColor,
    #[serde(rename = "@line_info")]
    line_info: HexColor,
    #[serde(rename = "@line_error")]
    line_error: HexColor,
    #[serde(rename = "@cursor")]
    cursor: HexColor,
    #[serde(rename = "@select")]
    select: HexColor,
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct ClipEditor {
    pub theme_clip_editor: ThemeClipEditor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeClipEditor {
    #[serde(rename = "@grid")]
    pub grid: HexColor,
    #[serde(rename = "@marker_outline")]
    pub marker_outline: HexColor,
    #[serde(rename = "@marker")]
    pub marker: HexColor,
    #[serde(rename = "@active_marker")]
    pub active_marker: HexColor,
    #[serde(rename = "@selected_marker")]
    pub selected_marker: HexColor,
    #[serde(rename = "@disabled_marker")]
    pub disabled_marker: HexColor,
    #[serde(rename = "@locked_marker")]
    pub locked_marker: HexColor,
    #[serde(rename = "@path_before")]
    pub path_before: HexColor,
    #[serde(rename = "@path_after")]
    pub path_after: HexColor,
    #[serde(rename = "@path_keyframe_before")]
    pub path_keyframe_before: HexColor,
    #[serde(rename = "@path_keyframe_after")]
    pub path_keyframe_after: HexColor,
    #[serde(rename = "@frame_current")]
    pub frame_current: HexColor,
    #[serde(rename = "@time_scrub_background")]
    pub time_scrub_background: HexColor,
    #[serde(rename = "@time_marker_line")]
    pub time_marker_line: HexColor,
    #[serde(rename = "@time_marker_line_selected")]
    pub time_marker_line_selected: HexColor,
    #[serde(rename = "@strips")]
    pub strips: HexColor,
    #[serde(rename = "@strips_selected")]
    pub strips_selected: HexColor,
    #[serde(rename = "@metadatabg")]
    pub metadatabg: HexColor,
    #[serde(rename = "@metadatatext")]
    pub metadatatext: HexColor,
    #[serde(rename = "@handle_free")]
    pub handle_free: HexColor,
    #[serde(rename = "@handle_auto")]
    pub handle_auto: HexColor,
    #[serde(rename = "@handle_align")]
    pub handle_align: HexColor,
    #[serde(rename = "@handle_sel_free")]
    pub handle_sel_free: HexColor,
    #[serde(rename = "@handle_sel_auto")]
    pub handle_sel_auto: HexColor,
    #[serde(rename = "@handle_sel_align")]
    pub handle_sel_align: HexColor,
    #[serde(rename = "@handle_auto_clamped")]
    pub handle_auto_clamped: HexColor,
    #[serde(rename = "@handle_sel_auto_clamped")]
    pub handle_sel_auto_clamped: HexColor,
    #[serde(rename = "@handle_vertex")]
    pub handle_vertex: HexColor,
    #[serde(rename = "@handle_vertex_select")]
    pub handle_vertex_select: HexColor,
    #[serde(rename = "@handle_vertex_size")]
    pub handle_vertex_size: u8,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Topbar {
    pub theme_top_bar: ThemeTopBar,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeTopBar {
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Statusbar {
    pub theme_status_bar: ThemeStatusBar,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeStatusBar {
    pub space: Space,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Spreadsheet {
    pub theme_spreadsheet: ThemeSpreadsheet,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeSpreadsheet {
    #[serde(rename = "@row_alternate")]
    pub row_alternate: HexColor,
    pub space: Space,
    pub space_list: SpaceList,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Space {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub theme_space_generic: Option<ThemeSpaceGeneric>,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub theme_space_gradient: Option<ThemeSpaceGradient>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeSpaceGeneric {
    #[serde(rename = "@back")]
    pub back: HexColor,
    #[serde(rename = "@title")]
    pub title: HexColor,
    #[serde(rename = "@text")]
    pub text: HexColor,
    #[serde(rename = "@text_hi")]
    pub text_hi: HexColor,
    #[serde(rename = "@header")]
    pub header: HexColor,
    #[serde(rename = "@header_text")]
    pub header_text: HexColor,
    #[serde(rename = "@header_text_hi")]
    pub header_text_hi: HexColor,
    #[serde(rename = "@button")]
    pub button: HexColor,
    #[serde(rename = "@button_title")]
    pub button_title: HexColor,
    #[serde(rename = "@button_text")]
    pub button_text: HexColor,
    #[serde(rename = "@button_text_hi")]
    pub button_text_hi: HexColor,
    #[serde(rename = "@navigation_bar")]
    pub navigation_bar: HexColor,
    #[serde(rename = "@execution_buts")]
    pub execution_buts: HexColor,
    #[serde(rename = "@tab_active")]
    pub tab_active: HexColor,
    #[serde(rename = "@tab_inactive")]
    pub tab_inactive: HexColor,
    #[serde(rename = "@tab_back")]
    pub tab_back: HexColor,
    #[serde(rename = "@tab_outline")]
    pub tab_outline: HexColor,
    pub panelcolors: Panelcolors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeSpaceGradient {
    #[serde(rename = "@title")]
    pub title: HexColor,
    #[serde(rename = "@text")]
    pub text: HexColor,
    #[serde(rename = "@text_hi")]
    pub text_hi: HexColor,
    #[serde(rename = "@header")]
    pub header: HexColor,
    #[serde(rename = "@header_text")]
    pub header_text: HexColor,
    #[serde(rename = "@header_text_hi")]
    pub header_text_hi: HexColor,
    #[serde(rename = "@button")]
    pub button: HexColor,
    #[serde(rename = "@button_title")]
    pub button_title: HexColor,
    #[serde(rename = "@button_text")]
    pub button_text: HexColor,
    #[serde(rename = "@button_text_hi")]
    pub button_text_hi: HexColor,
    #[serde(rename = "@navigation_bar")]
    pub navigation_bar: HexColor,
    #[serde(rename = "@execution_buts")]
    pub execution_buts: HexColor,
    #[serde(rename = "@tab_active")]
    pub tab_active: HexColor,
    #[serde(rename = "@tab_inactive")]
    pub tab_inactive: HexColor,
    #[serde(rename = "@tab_back")]
    pub tab_back: HexColor,
    #[serde(rename = "@tab_outline")]
    pub tab_outline: HexColor,
    pub gradients: Gradients,
    pub panelcolors: Panelcolors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Gradients {
    pub theme_gradient_colors: ThemeGradientColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeGradientColors {
    #[serde(rename = "@background_type")]
    pub background_type: BackGroundType,
    #[serde(rename = "@high_gradient")]
    pub high_gradient: HexColor,
    #[serde(rename = "@gradient")]
    pub gradient: HexColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Panelcolors {
    pub theme_panel_colors: ThemePanelColors,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemePanelColors {
    #[serde(rename = "@header")]
    pub header: HexColor,
    #[serde(rename = "@back")]
    pub back: HexColor,
    #[serde(rename = "@sub_back")]
    pub sub_back: HexColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct SpaceList {
    pub theme_space_list_generic: ThemeSpaceListGeneric,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeSpaceListGeneric {
    #[serde(rename = "@list")]
    pub list: HexColor,
    #[serde(rename = "@list_title")]
    pub list_title: HexColor,
    #[serde(rename = "@list_text")]
    pub list_text: HexColor,
    #[serde(rename = "@list_text_hi")]
    pub list_text_hi: HexColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct BoneColorSets {
    pub theme_bone_color_set: Vec<ThemeBoneColorSet>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeBoneColorSet {
    #[serde(rename = "@normal")]
    pub normal: HexColor,
    #[serde(rename = "@select")]
    pub select: HexColor,
    #[serde(rename = "@active")]
    pub active: HexColor,
    #[serde(rename = "@show_colored_constraints")]
    pub show_colored_constraints: Boolean,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct CollectionColor {
    pub theme_collection_color: Vec<ThemeCollectionColor>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeCollectionColor {
    #[serde(rename = "@color")]
    pub color: HexColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct StripColor {
    pub theme_strip_color: Vec<ThemeStripColor>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeStripColor {
    #[serde(rename = "@color")]
    pub color: HexColor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeStyle {
    pub panel_title: PanelTitle,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub widget_label: Option<WidgetLabel>,
    pub widget: Widget,
    #[serde(skip_serializing_if = "Option::is_none")]
    pub tooltip: Option<ToolTip>,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct PanelTitle {
    pub theme_font_style: ThemeFontStyle,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct WidgetLabel {
    pub theme_font_style: ThemeFontStyle,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct Widget {
    pub theme_font_style: ThemeFontStyle,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
#[serde(rename_all = "PascalCase")]
pub struct ToolTip {
    pub theme_font_style: ThemeFontStyle,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub struct ThemeFontStyle {
    #[serde(rename = "@points")]
    pub points: u8,
    #[serde(
        rename = "@character_weight",
        skip_serializing_if = "Option::is_none"
    )]
    pub character_weight: Option<u16>,
    #[serde(rename = "@shadow")]
    pub shadow: u8,
    #[serde(rename = "@shadow_offset_x")]
    pub shadow_offset_x: i8,
    #[serde(rename = "@shadow_offset_y")]
    pub shadow_offset_y: i8,
    #[serde(rename = "@shadow_alpha")]
    pub shadow_alpha: Factor,
    #[serde(rename = "@shadow_value")]
    pub shadow_value: Factor,
}

#[derive(Clone, Serialize, Deserialize, Debug, PartialEq)]
pub enum Version {
    V3_6,
    V4_0,
    V4_1,
    V4_2,
    V4_3,
}

impl fmt::Display for Version {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        let version_str = match self {
            Version::V3_6 => "v3.6",
            Version::V4_0 => "v4.0",
            Version::V4_1 => "v4.1",
            Version::V4_2 => "v4.2",
            Version::V4_3 => "v4.3",
        };
        write!(f, "{version_str}")
    }
}

impl Version {
    /// Default Blender Dark Theme.
    pub fn get_default_theme(&self) -> color_eyre::Result<B3dTheme> {
        let path = self.get_path();
        let xml = fs::read_to_string(path)?;

        let xml_de = &mut quick_xml::de::Deserializer::from_str(&xml);
        let result: Result<Bpy, _> = serde_path_to_error::deserialize(xml_de);
        if let Err(err) = &result {
            let path = err.path();
            println!("{path:#?}");
        }

        let bpy: Bpy = quick_xml::de::from_str(&xml)?;
        let theme = B3dTheme {
            bpy,
            version: self.clone(),
        };
        Ok(theme)
    }

    fn get_path(&self) -> PathBuf {
        let crate_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
        let path_dir = crate_dir.join("themes/original");
        path_dir.join(self.file_name())
    }

    pub fn file_name(&self) -> String {
        format!("{self}_blender_dark.xml")
    }
}

impl B3dTheme {
    pub fn from_file<P: AsRef<Path>>(
        file_path: P,
        version: Version,
    ) -> color_eyre::Result<B3dTheme> {
        let xml = fs::read_to_string(file_path)?;

        let xml_de = &mut quick_xml::de::Deserializer::from_str(&xml);
        let result: Result<Bpy, _> = serde_path_to_error::deserialize(xml_de);
        if let Err(err) = &result {
            let path = err.path();
            println!("{path:#?}");
        }

        let bpy: Bpy = quick_xml::de::from_str(&xml)?;
        let theme = B3dTheme { bpy, version };
        Ok(theme)
    }

    pub fn save_theme<P: AsRef<Path>>(
        &self,
        file_path: P,
    ) -> color_eyre::Result<B3dTheme> {
        fs::create_dir_all(
            file_path.as_ref().parent().unwrap_or(&PathBuf::from(".")),
        )?;

        let xml_serialized = quick_xml::se::to_string(&self.bpy)?;

        let doc = Document::from_str(&xml_serialized)?;
        // let xml_serialized = doc.to_string_pretty_with_config(&Config {
        //     is_pretty: true,
        //     indent: 2,
        //     end_pad: 0,
        //     max_line_length: 0,
        //     entity_mode: EntityMode::Standard,
        //     indent_text_nodes: true,
        // });
        let config_pretty = Config::default_pretty()
            .indent(2)
            .end_pad(0)
            .max_line_length(0)
            .entity_mode(EntityMode::Standard)
            .indent_text_nodes(true);

        let xml_serialized = doc.to_string_pretty_with_config(&config_pretty);

        fs::write(file_path, &xml_serialized)?;

        let bpy: Bpy = quick_xml::de::from_str(&xml_serialized)?;
        let theme = B3dTheme {
            bpy,
            version: self.version.clone(),
        };

        assert_eq!(self, &theme);

        Ok(theme)
    }

    pub fn all_versions() -> Vec<Version> {
        vec![
            Version::V3_6,
            Version::V4_0,
            Version::V4_1,
            Version::V4_2,
            Version::V4_3,
        ]
    }
}