egui-charts 0.2.0

High-performance financial charting engine for egui — candlesticks, 95 drawing tools, 130+ indicators, and a full design-token theme system
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
//! Token parsing and resolution

use egui::Color32;
use std::collections::HashMap;

use super::raw::{RawColor, RawDesignTokens};
use super::resolved::{DesignTokens, SpacingTokens};
use super::semantic::{
    AlertSemanticTokens, BrandSemanticTokens, ButtonSemanticTokens, ChartSemanticTokens,
    CommandPaletteSemanticTokens, DrawingSemanticTokens, ExtendedSemanticTokens,
    FootprintSemanticTokens, HeatmapSemanticTokens, IndicatorSemanticTokens,
    ListItemSemanticTokens, ModalSemanticTokens, SemanticTokens, StatusSemanticTokens,
    TierSemanticTokens, ToastSemanticTokens, TpoSemanticTokens, UiSemanticTokens,
};
use super::sizing::{
    AnnotationSizingTokens, AuthDialogSizingTokens, BurgerMenuSizingTokens, CandleSizingTokens,
    ChartSizingTokens, ChartsExtSizingTokens, CommandPaletteSizingTokens, ContextMenuSizingTokens,
    CrosshairSizingTokens, CursorSizingTokens, DialogSizingTokens, DrawingSizingTokens,
    DrawingToolbarExtSizingTokens, EmojiPickerSizingTokens, FloatingToolbarSizingTokens,
    FootprintSizingTokens, LayoutTokens, MediaSizingTokens, MenuSizingTokens,
    NotificationSizingTokens, PanelSizingTokens, PositionToolSizingTokens, ReplaySizingTokens,
    RightSidebarSizingTokens, RoundingTokens, SettingsDialogSizingTokens, ShadowTokens,
    SizingTokens, StrokeTokens, SymbolHeaderSizingTokens, TechnicalLabelsSizingTokens,
    TimeframeToolbarSizingTokens, ToolbarSizingTokens, TooltipSizingTokens, TypographyTokens,
    WatermarkSizingTokens, WidgetSizingTokens,
};

/// Parse the raw RON tokens into the final DesignTokens structure
pub(super) fn parse_tokens(tokens_ron: &str) -> Result<DesignTokens, String> {
    let raw: RawDesignTokens =
        ron::from_str(tokens_ron).map_err(|e| format!("Failed to parse design_tokens.ron: {e}"))?;

    Ok(resolve_tokens(raw))
}

/// Resolve color references and convert raw tokens to final format
fn resolve_tokens(raw: RawDesignTokens) -> DesignTokens {
    // Build color lookup map from palette
    let mut color_map: HashMap<String, Color32> = HashMap::new();

    for (name, color) in &raw.palette {
        let c = raw_color_to_color32(color);
        color_map.insert(name.clone(), c);
    }

    // Helper to resolve a color (either reference or direct value)
    let resolve_color = |raw: &RawColor| -> Color32 {
        match raw {
            RawColor::Reference(name) => {
                color_map.get(name).copied().unwrap_or(Color32::PLACEHOLDER)
            }
            RawColor::Rgb(r, g, b) => Color32::from_rgb(*r, *g, *b),
            RawColor::Rgba(r, g, b, a) => Color32::from_rgba_unmultiplied(*r, *g, *b, *a),
        }
    };

    DesignTokens {
        spacing: SpacingTokens {
            xs: raw.spacing.xs,
            sm: raw.spacing.sm,
            md: raw.spacing.md,
            lg: raw.spacing.lg,
            xl: raw.spacing.xl,
            xxl: raw.spacing.xxl,
            xxxl: raw.spacing.xxxl,
            hairline: raw.spacing.hairline,
            section_lg: raw.spacing.section_lg,
            panel_gap: raw.spacing.panel_gap,
            button_padding: raw.spacing.button_padding,
            toolbar_item_gap: raw.spacing.toolbar_item_gap,
            menu_item_padding: raw.spacing.menu_item_padding,
        },
        sizing: SizingTokens {
            target_min: raw.sizing.target_min,
            icon_xs: raw.sizing.icon_xs,
            icon_14: raw.sizing.icon_14,
            icon_sm: raw.sizing.icon_sm,
            icon_md: raw.sizing.icon_md,
            icon_btn: raw.sizing.icon_btn,
            icon_lg: raw.sizing.icon_lg,
            icon_xl: raw.sizing.icon_xl,
            icon_xxl: raw.sizing.icon_xxl,
            button_sm: raw.sizing.button_sm,
            button_md: raw.sizing.button_md,
            button_dialog: raw.sizing.button_dialog,
            button_lg: raw.sizing.button_lg,
            button_xl: raw.sizing.button_xl,
            button_xxl: raw.sizing.button_xxl,
            button_min_width_xs: raw.sizing.button_min_width_xs,
            button_min_width_sm: raw.sizing.button_min_width_sm,
            button_min_width_md: raw.sizing.button_min_width_md,
            button_min_width_lg: raw.sizing.button_min_width_lg,
            list_item_height: raw.sizing.list_item_height,
            menu_item_height: raw.sizing.menu_item_height,
            toolbar: ToolbarSizingTokens {
                top_height: raw.sizing.toolbar.top_height,
                left_width: raw.sizing.toolbar.left_width,
                bottom_height: raw.sizing.toolbar.bottom_height,
                right_icon_width: raw.sizing.toolbar.right_icon_width,
                right_panel_width: raw.sizing.toolbar.right_panel_width,
                right_panel_min_width: raw.sizing.toolbar.right_panel_min_width,
                right_panel_max_width: raw.sizing.toolbar.right_panel_max_width,
                // Exact toolbar dimensions
                left_toolbar_width: raw.sizing.toolbar.left_toolbar_width,
                button_width: raw.sizing.toolbar.button_width,
                button_height: raw.sizing.toolbar.button_height,
                hover_margin_h: raw.sizing.toolbar.hover_margin_h,
                hover_margin_v: raw.sizing.toolbar.hover_margin_v,
                inner_rounding: raw.sizing.toolbar.inner_rounding,
                icon_size: raw.sizing.toolbar.icon_size,
                separator_margin: raw.sizing.toolbar.separator_margin,
                separator_gap: raw.sizing.toolbar.separator_gap,
                // Right sidebar (widget bar) exact dimensions
                right_sidebar_width: raw.sizing.toolbar.right_sidebar_width,
                right_btn_size: raw.sizing.toolbar.right_btn_size,
                right_icon_size: raw.sizing.toolbar.right_icon_size,
                right_btn_spacing: raw.sizing.toolbar.right_btn_spacing,
                right_hover_margin: raw.sizing.toolbar.right_hover_margin,
                right_hover_rounding: raw.sizing.toolbar.right_hover_rounding,
                // Top toolbar separator dimensions
                separator_height: raw.sizing.toolbar.separator_height,
                separator_width: raw.sizing.toolbar.separator_width,
            },
            panel: PanelSizingTokens {
                bottom_default_height: raw.sizing.panel.bottom_default_height,
                bottom_min_height: raw.sizing.panel.bottom_min_height,
                bottom_max_height: raw.sizing.panel.bottom_max_height,
                bottom_toolbar_height: raw.sizing.panel.bottom_toolbar_height,
                widget_default_width: raw.sizing.panel.widget_default_width,
                widget_default_height: raw.sizing.panel.widget_default_height,
                widget_min_width: raw.sizing.panel.widget_min_width,
                widget_min_height: raw.sizing.panel.widget_min_height,
                // Trading panel row dimensions
                trading_panel_row_height: raw.sizing.panel.trading_panel_row_height,
                trading_panel_row_icon_size: raw.sizing.panel.trading_panel_row_icon_size,
                trading_panel_row_btn_size: raw.sizing.panel.trading_panel_row_btn_size,
                trading_panel_row_icon_size_touch: raw
                    .sizing
                    .panel
                    .trading_panel_row_icon_size_touch,
                trading_panel_row_btn_size_touch: raw.sizing.panel.trading_panel_row_btn_size_touch,
            },
            dialog: DialogSizingTokens {
                symbol_search_width: raw.sizing.dialog.symbol_search_width,
                symbol_search_height: raw.sizing.dialog.symbol_search_height,
                submenu_width: raw.sizing.dialog.submenu_width,
                submenu_item_height: raw.sizing.dialog.submenu_item_height,
                color_picker_width: raw.sizing.dialog.color_picker_width,
                color_picker_height: raw.sizing.dialog.color_picker_height,
                menu_settings_width: raw.sizing.dialog.menu_settings_width,
                menu_settings_height: raw.sizing.dialog.menu_settings_height,
                default_width: raw.sizing.dialog.default_width,
                default_height: raw.sizing.dialog.default_height,
                default_min_height: raw.sizing.dialog.default_min_height,
                confirm_width: raw.sizing.dialog.confirm_width,
                prompt_width_sm: raw.sizing.dialog.prompt_width_sm,
                prompt_width_lg: raw.sizing.dialog.prompt_width_lg,
                alert_width: raw.sizing.dialog.alert_width,
                properties_height: raw.sizing.dialog.properties_height,
                label_width: raw.sizing.dialog.label_width,
                input_width: raw.sizing.dialog.input_width,
                series_sidebar_width: raw.sizing.dialog.series_sidebar_width,
                grid_dropdown_width: raw.sizing.dialog.grid_dropdown_width,
                indicator_item_width: raw.sizing.dialog.indicator_item_width,
                button_min_width_xs: raw.sizing.dialog.button_min_width_xs,
            },
            auth_dialog: AuthDialogSizingTokens {
                user_menu_width: raw.sizing.auth_dialog.user_menu_width,
            },
            settings_dialog: SettingsDialogSizingTokens {
                width: raw.sizing.settings_dialog.width,
                height: raw.sizing.settings_dialog.height,
                min_width: raw.sizing.settings_dialog.min_width,
                max_width: raw.sizing.settings_dialog.max_width,
                rounding: raw.sizing.settings_dialog.rounding,
                title_height: raw.sizing.settings_dialog.title_height,
                title_font_size: raw.sizing.settings_dialog.title_font_size,
                title_padding_left: raw.sizing.settings_dialog.title_padding_left,
                close_button_size: raw.sizing.settings_dialog.close_button_size,
                close_button_margin: raw.sizing.settings_dialog.close_button_margin,
                close_icon_size: raw.sizing.settings_dialog.close_icon_size,
                sidebar_width: raw.sizing.settings_dialog.sidebar_width,
                tab_height: raw.sizing.settings_dialog.tab_height,
                tab_padding_h: raw.sizing.settings_dialog.tab_padding_h,
                tab_padding_v: raw.sizing.settings_dialog.tab_padding_v,
                tab_icon_size: raw.sizing.settings_dialog.tab_icon_size,
                tab_icon_text_gap: raw.sizing.settings_dialog.tab_icon_text_gap,
                tab_font_size: raw.sizing.settings_dialog.tab_font_size,
                content_padding_top: raw.sizing.settings_dialog.content_padding_top,
                content_padding_h: raw.sizing.settings_dialog.content_padding_h,
                scroll_area_height: raw.sizing.settings_dialog.scroll_area_height,
                content_min_width: raw.sizing.settings_dialog.content_min_width,
                section_margin_top: raw.sizing.settings_dialog.section_margin_top,
                section_margin_bottom: raw.sizing.settings_dialog.section_margin_bottom,
                section_font_size: raw.sizing.settings_dialog.section_font_size,
                row_height: raw.sizing.settings_dialog.row_height,
                row_spacing: raw.sizing.settings_dialog.row_spacing,
                label_width: raw.sizing.settings_dialog.label_width,
                control_height: raw.sizing.settings_dialog.control_height,
                dropdown_width: raw.sizing.settings_dialog.dropdown_width,
                input_width: raw.sizing.settings_dialog.input_width,
                swatch_size: raw.sizing.settings_dialog.swatch_size,
                checkbox_size: raw.sizing.settings_dialog.checkbox_size,
                slider_width: raw.sizing.settings_dialog.slider_width,
                small_input_width: raw.sizing.settings_dialog.small_input_width,
                input_width_margin: raw.sizing.settings_dialog.input_width_margin,
                section_spacing: raw.sizing.settings_dialog.section_spacing,
                footer_height: raw.sizing.settings_dialog.footer_height,
                footer_padding_h: raw.sizing.settings_dialog.footer_padding_h,
                footer_padding_v: raw.sizing.settings_dialog.footer_padding_v,
                button_height: raw.sizing.settings_dialog.button_height,
                button_min_width: raw.sizing.settings_dialog.button_min_width,
                button_padding_h: raw.sizing.settings_dialog.button_padding_h,
                button_gap: raw.sizing.settings_dialog.button_gap,
                small_dropdown_width: raw.sizing.settings_dialog.small_dropdown_width,
                xs_dropdown_width: raw.sizing.settings_dialog.xs_dropdown_width,
                template_button_width: raw.sizing.settings_dialog.template_button_width,
                template_menu_width: raw.sizing.settings_dialog.template_menu_width,
                template_menu_max_height: raw.sizing.settings_dialog.template_menu_max_height,
                indicator_width: raw.sizing.settings_dialog.indicator_width,
                indicator_offset: raw.sizing.settings_dialog.indicator_offset,
                grid_col_spacing: raw.sizing.settings_dialog.grid_col_spacing,
                grid_row_spacing: raw.sizing.settings_dialog.grid_row_spacing,
            },
            context_menu: ContextMenuSizingTokens {
                min_width: raw.sizing.context_menu.min_width,
                max_width: raw.sizing.context_menu.max_width,
                rounding: raw.sizing.context_menu.rounding,
                padding_v: raw.sizing.context_menu.padding_v,
                item_height: raw.sizing.context_menu.item_height,
                item_padding_h: raw.sizing.context_menu.item_padding_h,
                item_padding_v: raw.sizing.context_menu.item_padding_v,
                icon_width: raw.sizing.context_menu.icon_width,
                icon_size: raw.sizing.context_menu.icon_size,
                icon_label_gap: raw.sizing.context_menu.icon_label_gap,
                font_size: raw.sizing.context_menu.font_size,
                shortcut_font_size: raw.sizing.context_menu.shortcut_font_size,
                separator_height: raw.sizing.context_menu.separator_height,
                separator_thickness: raw.sizing.context_menu.separator_thickness,
                separator_margin_h: raw.sizing.context_menu.separator_margin_h,
                submenu_arrow_size: raw.sizing.context_menu.submenu_arrow_size,
                submenu_offset: raw.sizing.context_menu.submenu_offset,
                shortcut_width: raw.sizing.context_menu.shortcut_width,
                char_width: raw.sizing.context_menu.char_width,
                screen_edge_padding: raw.sizing.context_menu.screen_edge_padding,
                submenu_arrow_font_size: raw.sizing.context_menu.submenu_arrow_font_size,
            },
            right_sidebar: RightSidebarSizingTokens {
                width: raw.sizing.right_sidebar.width,
                min_width: raw.sizing.right_sidebar.min_width,
                max_width: raw.sizing.right_sidebar.max_width,
            },
            watermark: WatermarkSizingTokens {
                font_size: raw.sizing.watermark.font_size,
                padding: raw.sizing.watermark.padding,
                line_spacing: raw.sizing.watermark.line_spacing,
            },
            burger_menu: BurgerMenuSizingTokens {
                button_size: raw.sizing.burger_menu.button_size,
                line_width_ratio: raw.sizing.burger_menu.line_width_ratio,
                line_height: raw.sizing.burger_menu.line_height,
                line_spacing_ratio: raw.sizing.burger_menu.line_spacing_ratio,
                panel_width: raw.sizing.burger_menu.panel_width,
                header_padding: raw.sizing.burger_menu.header_padding,
                header_spacing: raw.sizing.burger_menu.header_spacing,
                separator_padding: raw.sizing.burger_menu.separator_padding,
                item_height: raw.sizing.burger_menu.item_height,
                item_padding: raw.sizing.burger_menu.item_padding,
                icon_size: raw.sizing.burger_menu.icon_size,
                font_size: raw.sizing.burger_menu.font_size,
            },
            symbol_header: SymbolHeaderSizingTokens {
                height: raw.sizing.symbol_header.height,
                quote_box_height: raw.sizing.symbol_header.quote_box_height,
            },
            timeframe_toolbar: TimeframeToolbarSizingTokens {
                right_section_width: raw.sizing.timeframe_toolbar.right_section_width,
            },
            footprint: FootprintSizingTokens {
                bar_width_ratio: raw.sizing.footprint.bar_width_ratio,
                poc_height_multiplier: raw.sizing.footprint.poc_height_multiplier,
                value_area_alpha: raw.sizing.footprint.value_area_alpha,
                stacked_imbalance_alpha: raw.sizing.footprint.stacked_imbalance_alpha,
            },
            chart: ChartSizingTokens {
                padding: raw.sizing.chart.padding,
                right_axis_width: raw.sizing.chart.right_axis_width,
            },
            candle: CandleSizingTokens {
                body_width_ratio: raw.sizing.candle.body_width_ratio,
                wick_width: raw.sizing.candle.wick_width,
                wick_width_hidpi: raw.sizing.candle.wick_width_hidpi,
                min_body_height: raw.sizing.candle.min_body_height,
                volume_alpha: raw.sizing.candle.volume_alpha,
                grid_width: raw.sizing.candle.grid_width,
            },
            floating_toolbar: FloatingToolbarSizingTokens {
                default_x: raw.sizing.floating_toolbar.default_x,
                default_y: raw.sizing.floating_toolbar.default_y,
                drag_handle_width: raw.sizing.floating_toolbar.drag_handle_width,
                button_size: raw.sizing.floating_toolbar.button_size,
                color_size: raw.sizing.floating_toolbar.color_size,
                separator_width: raw.sizing.floating_toolbar.separator_width,
                drag_handle_height: raw.sizing.floating_toolbar.drag_handle_height,
                height: raw.sizing.floating_toolbar.height,
                dot_size: raw.sizing.floating_toolbar.dot_size,
                dot_spacing: raw.sizing.floating_toolbar.dot_spacing,
                separator_height: raw.sizing.floating_toolbar.separator_height,
            },
            command_palette: CommandPaletteSizingTokens {
                width: raw.sizing.command_palette.width,
                height: raw.sizing.command_palette.height,
                margin_x: raw.sizing.command_palette.margin_x,
                margin_y: raw.sizing.command_palette.margin_y,
                input_padding: raw.sizing.command_palette.input_padding,
                scroll_padding: raw.sizing.command_palette.scroll_padding,
            },
            replay: ReplaySizingTokens {
                control_bar_height: raw.sizing.replay.control_bar_height,
                button_size: raw.sizing.replay.button_size,
                speed_dropdown_width: raw.sizing.replay.speed_dropdown_width,
                date_display_width: raw.sizing.replay.date_display_width,
                progress_bar_width: raw.sizing.replay.progress_bar_width,
            },
            emoji_picker: EmojiPickerSizingTokens {
                width: raw.sizing.emoji_picker.width,
                cell_size: raw.sizing.emoji_picker.cell_size,
                cell_size_lg: raw.sizing.emoji_picker.cell_size_lg,
                category_width: raw.sizing.emoji_picker.category_width,
                submenu_width: raw.sizing.emoji_picker.submenu_width,
                input_padding: raw.sizing.emoji_picker.input_padding,
            },
            drawing_toolbar_ext: DrawingToolbarExtSizingTokens {
                submenu_width_sm: raw.sizing.drawing_toolbar_ext.submenu_width_sm,
                submenu_width_lg: raw.sizing.drawing_toolbar_ext.submenu_width_lg,
                submenu_width_xl: raw.sizing.drawing_toolbar_ext.submenu_width_xl,
                min_icon: raw.sizing.drawing_toolbar_ext.min_icon,
                min_width: raw.sizing.drawing_toolbar_ext.min_width,
                name_offset_active: raw.sizing.drawing_toolbar_ext.name_offset_active,
                name_offset_inactive: raw.sizing.drawing_toolbar_ext.name_offset_inactive,
                submenu_offset_y: raw.sizing.drawing_toolbar_ext.submenu_offset_y,
                submenu_margin: raw.sizing.drawing_toolbar_ext.submenu_margin,
            },
            annotation: AnnotationSizingTokens {
                label_padding_x: raw.sizing.annotation.label_padding_x,
                label_padding_y: raw.sizing.annotation.label_padding_y,
                callout_padding_x: raw.sizing.annotation.callout_padding_x,
                callout_padding_y: raw.sizing.annotation.callout_padding_y,
                pointer_size: raw.sizing.annotation.pointer_size,
                comment_bubble_width: raw.sizing.annotation.comment_bubble_width,
                comment_bubble_height: raw.sizing.annotation.comment_bubble_height,
                note_size: raw.sizing.annotation.note_size,
                note_fold_size: raw.sizing.annotation.note_fold_size,
                table_cell_width: raw.sizing.annotation.table_cell_width,
                table_cell_height: raw.sizing.annotation.table_cell_height,
                table_header_height: raw.sizing.annotation.table_header_height,
                flag_pole_length: raw.sizing.annotation.flag_pole_length,
                flag_width: raw.sizing.annotation.flag_width,
                flag_height: raw.sizing.annotation.flag_height,
                signpost_padding_x: raw.sizing.annotation.signpost_padding_x,
                signpost_padding_y: raw.sizing.annotation.signpost_padding_y,
                signpost_post_width: raw.sizing.annotation.signpost_post_width,
                signpost_post_height: raw.sizing.annotation.signpost_post_height,
                signpost_bracket: raw.sizing.annotation.signpost_bracket,
                text_padding_x: raw.sizing.annotation.text_padding_x,
                text_padding_y: raw.sizing.annotation.text_padding_y,
                text_line_height: raw.sizing.annotation.text_line_height,
                text_inner_padding: raw.sizing.annotation.text_inner_padding,
                text_anchored_size: raw.sizing.annotation.text_anchored_size,
            },
            media: MediaSizingTokens {
                image_min_width: raw.sizing.media.image_min_width,
                image_min_height: raw.sizing.media.image_min_height,
                image_default_width: raw.sizing.media.image_default_width,
                image_default_height: raw.sizing.media.image_default_height,
                checkerboard_size: raw.sizing.media.checkerboard_size,
                tweet_card_width: raw.sizing.media.tweet_card_width,
                tweet_card_height: raw.sizing.media.tweet_card_height,
                idea_card_width: raw.sizing.media.idea_card_width,
                idea_card_height: raw.sizing.media.idea_card_height,
                profile_radius: raw.sizing.media.profile_radius,
            },
            crosshair: CrosshairSizingTokens {
                dot_radius: raw.sizing.crosshair.dot_radius,
                label_offset_x: raw.sizing.crosshair.label_offset_x,
                label_offset_y: raw.sizing.crosshair.label_offset_y,
                label_rounding: raw.sizing.crosshair.label_rounding,
                plus_symbol_spacing: raw.sizing.crosshair.plus_symbol_spacing,
                dash_on: raw.sizing.crosshair.dash_on,
                dash_off: raw.sizing.crosshair.dash_off,
            },
            position_tool: PositionToolSizingTokens {
                min_width: raw.sizing.position_tool.min_width,
                label_info_width: raw.sizing.position_tool.label_info_width,
                label_info_height: raw.sizing.position_tool.label_info_height,
                label_target_width: raw.sizing.position_tool.label_target_width,
                label_offset_x: raw.sizing.position_tool.label_offset_x,
                label_offset_y: raw.sizing.position_tool.label_offset_y,
                text_offset_x: raw.sizing.position_tool.text_offset_x,
                text_offset_y: raw.sizing.position_tool.text_offset_y,
            },
            charts_ext: ChartsExtSizingTokens {
                min_width: raw.sizing.charts_ext.min_width,
                min_height: raw.sizing.charts_ext.min_height,
                indicator_pane_min: raw.sizing.charts_ext.indicator_pane_min,
                indicator_pane_default: raw.sizing.charts_ext.indicator_pane_default,
                volume_bubbles_max_diameter: raw.sizing.charts_ext.volume_bubbles_max_diameter,
                heatmap_strip_height: raw.sizing.charts_ext.heatmap_strip_height,
                order_line_label_width: raw.sizing.charts_ext.order_line_label_width,
                order_line_label_height: raw.sizing.charts_ext.order_line_label_height,
                time_label_min_spacing: raw.sizing.charts_ext.time_label_min_spacing,
                time_label_max_spacing: raw.sizing.charts_ext.time_label_max_spacing,
                price_label_min_spacing: raw.sizing.charts_ext.price_label_min_spacing,
                realtime_button_width: raw.sizing.charts_ext.realtime_button_width,
                price_scale_width: raw.sizing.charts_ext.price_scale_width,
                time_scale_height: raw.sizing.charts_ext.time_scale_height,
            },
            technical_labels: TechnicalLabelsSizingTokens {
                gann_label_width: raw.sizing.technical_labels.gann_label_width,
                gann_label_height: raw.sizing.technical_labels.gann_label_height,
                elliott_label_size: raw.sizing.technical_labels.elliott_label_size,
                fib_label_offset_x: raw.sizing.technical_labels.fib_label_offset_x,
                fib_timezone_width: raw.sizing.technical_labels.fib_timezone_width,
                fib_timezone_height: raw.sizing.technical_labels.fib_timezone_height,
                channel_label_width: raw.sizing.technical_labels.channel_label_width,
                channel_label_height: raw.sizing.technical_labels.channel_label_height,
                channel_offset_x: raw.sizing.technical_labels.channel_offset_x,
                cycle_label_width: raw.sizing.technical_labels.cycle_label_width,
                cycle_label_height: raw.sizing.technical_labels.cycle_label_height,
                pattern_label_width: raw.sizing.technical_labels.pattern_label_width,
                pattern_label_height: raw.sizing.technical_labels.pattern_label_height,
                line_label_width: raw.sizing.technical_labels.line_label_width,
                line_label_height: raw.sizing.technical_labels.line_label_height,
                line_arc_radius: raw.sizing.technical_labels.line_arc_radius,
                hs_label_width: raw.sizing.technical_labels.hs_label_width,
            },
            tooltip: TooltipSizingTokens {
                cursor_offset_x: raw.sizing.tooltip.cursor_offset_x,
                padding_x: raw.sizing.tooltip.padding_x,
                padding_y: raw.sizing.tooltip.padding_y,
            },
            cursor: CursorSizingTokens {},
            drawing: DrawingSizingTokens {
                magnet_distance: raw.sizing.drawing.magnet_distance,
            },
            notification: NotificationSizingTokens {
                panel_width: raw.sizing.notification.panel_width,
            },
            widget: WidgetSizingTokens {
                bid_ask_height: raw.sizing.widget.bid_ask_height,
            },
            menu: MenuSizingTokens {
                item_height: raw.sizing.menu.item_height,
            },
        },
        rounding: RoundingTokens {
            none: raw.rounding.none,
            xs: raw.rounding.xs,
            sm: raw.rounding.sm,
            md: raw.rounding.md,
            lg: raw.rounding.lg,
            xl: raw.rounding.xl,
            pill: raw.rounding.pill,
            button: raw.rounding.button,
            panel: raw.rounding.panel,
            dialog: raw.rounding.dialog,
            input: raw.rounding.input,
        },
        typography: TypographyTokens {
            micro: raw.typography.micro,
            tiny: raw.typography.tiny,
            xs: raw.typography.xs,
            sm: raw.typography.sm,
            md: raw.typography.md,
            lg: raw.typography.lg,
            xl: raw.typography.xl,
            xxl: raw.typography.xxl,
            xxxl: raw.typography.xxxl,
            body: raw.typography.body,
            small: raw.typography.small,
            heading: raw.typography.heading,
            title: raw.typography.title,
        },
        stroke: StrokeTokens {
            extra_thin: raw.stroke.extra_thin,
            light: raw.stroke.light,
            hairline: raw.stroke.hairline,
            thin: raw.stroke.thin,
            medium: raw.stroke.medium,
            thick: raw.stroke.thick,
        },
        shadow: ShadowTokens {
            offset_sm: raw.shadow.offset_sm,
            offset_md: raw.shadow.offset_md,
        },
        layout: LayoutTokens {
            menu_shadow_offset_x: raw.layout.menu_shadow_offset_x,
            menu_shadow_offset_y: raw.layout.menu_shadow_offset_y,
            label_offset_sm: raw.layout.label_offset_sm,
            label_offset_md: raw.layout.label_offset_md,
        },
        semantic: SemanticTokens {
            ui: UiSemanticTokens {
                panel_bg_light: resolve_color(&raw.semantic.ui.panel_bg_light),
                panel_bg_secondary_light: resolve_color(&raw.semantic.ui.panel_bg_secondary_light),
                text_light: resolve_color(&raw.semantic.ui.text_light),
                text_secondary_light: resolve_color(&raw.semantic.ui.text_secondary_light),
                text_muted_light: resolve_color(&raw.semantic.ui.text_muted_light),
                border_light: resolve_color(&raw.semantic.ui.border_light),
                border_subtle_light: resolve_color(&raw.semantic.ui.border_subtle_light),
                panel_bg_dark: resolve_color(&raw.semantic.ui.panel_bg_dark),
                panel_bg_secondary_dark: resolve_color(&raw.semantic.ui.panel_bg_secondary_dark),
                text_dark: resolve_color(&raw.semantic.ui.text_dark),
                text_secondary_dark: resolve_color(&raw.semantic.ui.text_secondary_dark),
                text_muted_dark: resolve_color(&raw.semantic.ui.text_muted_dark),
                border_dark: resolve_color(&raw.semantic.ui.border_dark),
                border_subtle_dark: resolve_color(&raw.semantic.ui.border_subtle_dark),
                icon_light: resolve_color(&raw.semantic.ui.icon_light),
                icon_hover_light: resolve_color(&raw.semantic.ui.icon_hover_light),
                icon_dark: resolve_color(&raw.semantic.ui.icon_dark),
                icon_hover_dark: resolve_color(&raw.semantic.ui.icon_hover_dark),
                icon_active: resolve_color(&raw.semantic.ui.icon_active),
                btn_bg_light: resolve_color(&raw.semantic.ui.btn_bg_light),
                btn_bg_hover_light: resolve_color(&raw.semantic.ui.btn_bg_hover_light),
                btn_bg_active_light: resolve_color(&raw.semantic.ui.btn_bg_active_light),
                btn_bg_dark: resolve_color(&raw.semantic.ui.btn_bg_dark),
                btn_bg_hover_dark: resolve_color(&raw.semantic.ui.btn_bg_hover_dark),
                btn_bg_active_dark: resolve_color(&raw.semantic.ui.btn_bg_active_dark),
                accent: resolve_color(&raw.semantic.ui.accent),
                accent_hover: resolve_color(&raw.semantic.ui.accent_hover),
                warning: resolve_color(&raw.semantic.ui.warning),
                success: resolve_color(&raw.semantic.ui.success),
            },
            chart: ChartSemanticTokens {
                bg: resolve_color(&raw.semantic.chart.bg),
                bg_axis: resolve_color(&raw.semantic.chart.bg_axis),
                bg_selection: resolve_color(&raw.semantic.chart.bg_selection),
                grid_line: resolve_color(&raw.semantic.chart.grid_line),
                grid_line_major: resolve_color(&raw.semantic.chart.grid_line_major),
                axis_text: resolve_color(&raw.semantic.chart.axis_text),
                axis_text_secondary: resolve_color(&raw.semantic.chart.axis_text_secondary),
                crosshair_line: resolve_color(&raw.semantic.chart.crosshair_line),
                crosshair_label_bg: resolve_color(&raw.semantic.chart.crosshair_label_bg),
                crosshair_label_text: resolve_color(&raw.semantic.chart.crosshair_label_text),
                bullish: resolve_color(&raw.semantic.chart.bullish),
                bearish: resolve_color(&raw.semantic.chart.bearish),
                bullish_fill: resolve_color(&raw.semantic.chart.bullish_fill),
                bearish_fill: resolve_color(&raw.semantic.chart.bearish_fill),
                volume_up_alpha: raw.semantic.chart.volume_up_alpha,
                volume_down_alpha: raw.semantic.chart.volume_down_alpha,
                volume: resolve_color(&raw.semantic.chart.volume),
                session_break: resolve_color(&raw.semantic.chart.session_break),
                watermark_alpha: raw.semantic.chart.watermark_alpha,
                selection_text: resolve_color(&raw.semantic.chart.selection_text),
                // Light chart variants
                bg_light: resolve_color(&raw.semantic.chart.bg_light),
                bg_axis_light: resolve_color(&raw.semantic.chart.bg_axis_light),
                bg_selection_light: resolve_color(&raw.semantic.chart.bg_selection_light),
                grid_line_light: resolve_color(&raw.semantic.chart.grid_line_light),
                grid_line_major_light: resolve_color(&raw.semantic.chart.grid_line_major_light),
                crosshair_line_light: resolve_color(&raw.semantic.chart.crosshair_line_light),
            },
            brand: BrandSemanticTokens {
                accent: resolve_color(&raw.semantic.brand.accent),
                accent_hover: resolve_color(&raw.semantic.brand.accent_hover),
            },
            status: StatusSemanticTokens {
                error: resolve_color(&raw.semantic.status.error),
                error_dark: resolve_color(&raw.semantic.status.error_dark),
                error_darker: resolve_color(&raw.semantic.status.error_darker),
                info: resolve_color(&raw.semantic.status.info),
                info_light: resolve_color(&raw.semantic.status.info_light),
                disabled: resolve_color(&raw.semantic.status.disabled),
                caution: resolve_color(&raw.semantic.status.caution),
            },
            footprint: FootprintSemanticTokens {
                poc: resolve_color(&raw.semantic.footprint.poc),
                value_area: resolve_color(&raw.semantic.footprint.value_area),
                imbalance_buy: resolve_color(&raw.semantic.footprint.imbalance_buy),
                imbalance_sell: resolve_color(&raw.semantic.footprint.imbalance_sell),
            },
            tpo: TpoSemanticTokens {
                poc: resolve_color(&raw.semantic.tpo.poc),
                value_area: resolve_color(&raw.semantic.tpo.value_area),
                initial_balance: resolve_color(&raw.semantic.tpo.initial_balance),
                single_print: resolve_color(&raw.semantic.tpo.single_print),
                session_separator: resolve_color(&raw.semantic.tpo.session_separator),
                letter_default: resolve_color(&raw.semantic.tpo.letter_default),
                opening_range: resolve_color(&raw.semantic.tpo.opening_range),
                grid: resolve_color(&raw.semantic.tpo.grid),
                period_1: resolve_color(&raw.semantic.tpo.period_1),
                period_2: resolve_color(&raw.semantic.tpo.period_2),
                period_3: resolve_color(&raw.semantic.tpo.period_3),
                period_4: resolve_color(&raw.semantic.tpo.period_4),
                period_5: resolve_color(&raw.semantic.tpo.period_5),
                period_6: resolve_color(&raw.semantic.tpo.period_6),
                period_7: resolve_color(&raw.semantic.tpo.period_7),
                period_8: resolve_color(&raw.semantic.tpo.period_8),
                period_9: resolve_color(&raw.semantic.tpo.period_9),
                period_10: resolve_color(&raw.semantic.tpo.period_10),
                period_11: resolve_color(&raw.semantic.tpo.period_11),
                period_12: resolve_color(&raw.semantic.tpo.period_12),
            },
            heatmap: HeatmapSemanticTokens {
                bid_1: resolve_color(&raw.semantic.heatmap.bid_1),
                bid_2: resolve_color(&raw.semantic.heatmap.bid_2),
                bid_3: resolve_color(&raw.semantic.heatmap.bid_3),
                bid_4: resolve_color(&raw.semantic.heatmap.bid_4),
                bid_5: resolve_color(&raw.semantic.heatmap.bid_5),
                ask_1: resolve_color(&raw.semantic.heatmap.ask_1),
                ask_2: resolve_color(&raw.semantic.heatmap.ask_2),
                ask_3: resolve_color(&raw.semantic.heatmap.ask_3),
                ask_4: resolve_color(&raw.semantic.heatmap.ask_4),
                ask_5: resolve_color(&raw.semantic.heatmap.ask_5),
                mid_price: resolve_color(&raw.semantic.heatmap.mid_price),
                border: resolve_color(&raw.semantic.heatmap.border),
                large_order_border: resolve_color(&raw.semantic.heatmap.large_order_border),
            },
            indicators: IndicatorSemanticTokens {
                ma: resolve_color(&raw.semantic.indicators.ma),
                ema: resolve_color(&raw.semantic.indicators.ema),
                sma: resolve_color(&raw.semantic.indicators.sma),
                bb_upper: resolve_color(&raw.semantic.indicators.bb_upper),
                bb_middle: resolve_color(&raw.semantic.indicators.bb_middle),
                bb_lower: resolve_color(&raw.semantic.indicators.bb_lower),
                bb_fill: resolve_color(&raw.semantic.indicators.bb_fill),
                rsi: resolve_color(&raw.semantic.indicators.rsi),
                rsi_overbought: resolve_color(&raw.semantic.indicators.rsi_overbought),
                rsi_oversold: resolve_color(&raw.semantic.indicators.rsi_oversold),
                macd_line: resolve_color(&raw.semantic.indicators.macd_line),
                macd_signal: resolve_color(&raw.semantic.indicators.macd_signal),
                macd_hist_pos: resolve_color(&raw.semantic.indicators.macd_hist_pos),
                macd_hist_neg: resolve_color(&raw.semantic.indicators.macd_hist_neg),
                vwap: resolve_color(&raw.semantic.indicators.vwap),
            },
            drawings: DrawingSemanticTokens {
                default_line: resolve_color(&raw.semantic.drawings.default_line),
                handle: resolve_color(&raw.semantic.drawings.handle),
                handle_hover: resolve_color(&raw.semantic.drawings.handle_hover),
                handle_active: resolve_color(&raw.semantic.drawings.handle_active),
                line_hover: resolve_color(&raw.semantic.drawings.line_hover),
                line_selected: resolve_color(&raw.semantic.drawings.line_selected),
                label_bg: resolve_color(&raw.semantic.drawings.label_bg),
                label_text: resolve_color(&raw.semantic.drawings.label_text),
                fib_0: resolve_color(&raw.semantic.drawings.fib_0),
                fib_236: resolve_color(&raw.semantic.drawings.fib_236),
                fib_382: resolve_color(&raw.semantic.drawings.fib_382),
                fib_50: resolve_color(&raw.semantic.drawings.fib_50),
                fib_618: resolve_color(&raw.semantic.drawings.fib_618),
                fib_100: resolve_color(&raw.semantic.drawings.fib_100),
            },
            tiers: TierSemanticTokens {
                free: resolve_color(&raw.semantic.tiers.free),
                pro: resolve_color(&raw.semantic.tiers.pro),
                premium: resolve_color(&raw.semantic.tiers.premium),
            },
            buttons: ButtonSemanticTokens {
                primary_bg: resolve_color(&raw.semantic.buttons.primary_bg),
                primary_bg_hover: resolve_color(&raw.semantic.buttons.primary_bg_hover),
                primary_bg_active: resolve_color(&raw.semantic.buttons.primary_bg_active),
                primary_fg: resolve_color(&raw.semantic.buttons.primary_fg),
                secondary_bg: resolve_color(&raw.semantic.buttons.secondary_bg),
                secondary_bg_hover: resolve_color(&raw.semantic.buttons.secondary_bg_hover),
                secondary_bg_active: resolve_color(&raw.semantic.buttons.secondary_bg_active),
                secondary_fg: resolve_color(&raw.semantic.buttons.secondary_fg),
                outlined_border: resolve_color(&raw.semantic.buttons.outlined_border),
                outlined_border_hover: resolve_color(&raw.semantic.buttons.outlined_border_hover),
                danger_bg: resolve_color(&raw.semantic.buttons.danger_bg),
                danger_bg_hover: resolve_color(&raw.semantic.buttons.danger_bg_hover),
                danger_bg_active: resolve_color(&raw.semantic.buttons.danger_bg_active),
                danger_fg: resolve_color(&raw.semantic.buttons.danger_fg),
            },
            list_item: ListItemSemanticTokens {
                hovered_bg: resolve_color(&raw.semantic.list_item.hovered_bg),
                active_bg: resolve_color(&raw.semantic.list_item.active_bg),
                default_text: resolve_color(&raw.semantic.list_item.default_text),
                hovered_text: resolve_color(&raw.semantic.list_item.hovered_text),
                active_text: resolve_color(&raw.semantic.list_item.active_text),
                strong_text: resolve_color(&raw.semantic.list_item.strong_text),
                noninteractive_text: resolve_color(&raw.semantic.list_item.noninteractive_text),
                text_on_primary: resolve_color(&raw.semantic.list_item.text_on_primary),
                text_on_primary_hovered: resolve_color(
                    &raw.semantic.list_item.text_on_primary_hovered,
                ),
                default_icon: resolve_color(&raw.semantic.list_item.default_icon),
                hovered_icon: resolve_color(&raw.semantic.list_item.hovered_icon),
                active_icon: resolve_color(&raw.semantic.list_item.active_icon),
                icon_on_primary: resolve_color(&raw.semantic.list_item.icon_on_primary),
                icon_on_primary_hovered: resolve_color(
                    &raw.semantic.list_item.icon_on_primary_hovered,
                ),
            },
            extended: ExtendedSemanticTokens {
                // UI backgrounds
                bg_outer: resolve_color(&raw.semantic.extended.bg_outer),
                bg_panel: resolve_color(&raw.semantic.extended.bg_panel),
                bg_hover: resolve_color(&raw.semantic.extended.bg_hover),
                bg_active: resolve_color(&raw.semantic.extended.bg_active),
                // UI borders
                border: resolve_color(&raw.semantic.extended.border),
                border_subtle: resolve_color(&raw.semantic.extended.border_subtle),
                // UI text
                text: resolve_color(&raw.semantic.extended.text),
                text_secondary: resolve_color(&raw.semantic.extended.text_secondary),
                text_muted: resolve_color(&raw.semantic.extended.text_muted),
                // Accent
                accent: resolve_color(&raw.semantic.extended.accent),
                accent_hover: resolve_color(&raw.semantic.extended.accent_hover),
                accent_active: resolve_color(&raw.semantic.extended.accent_active),
                // Status colors
                success: resolve_color(&raw.semantic.extended.success),
                success_light: resolve_color(&raw.semantic.extended.success_light),
                success_dark: resolve_color(&raw.semantic.extended.success_dark),
                success_darker: resolve_color(&raw.semantic.extended.success_darker),
                error: resolve_color(&raw.semantic.extended.error),
                error_dark: resolve_color(&raw.semantic.extended.error_dark),
                error_darker: resolve_color(&raw.semantic.extended.error_darker),
                warning: resolve_color(&raw.semantic.extended.warning),
                caution: resolve_color(&raw.semantic.extended.caution),
                info: resolve_color(&raw.semantic.extended.info),
                info_light: resolve_color(&raw.semantic.extended.info_light),
                disabled: resolve_color(&raw.semantic.extended.disabled),
                // Material design colors
                purple: resolve_color(&raw.semantic.extended.purple),
                deep_purple: resolve_color(&raw.semantic.extended.deep_purple),
                cyan: resolve_color(&raw.semantic.extended.cyan),
                teal: resolve_color(&raw.semantic.extended.teal),
                indigo: resolve_color(&raw.semantic.extended.indigo),
                pink: resolve_color(&raw.semantic.extended.pink),
                brown: resolve_color(&raw.semantic.extended.brown),
                deep_orange: resolve_color(&raw.semantic.extended.deep_orange),
                gray: resolve_color(&raw.semantic.extended.gray),
                light_gray: resolve_color(&raw.semantic.extended.light_gray),
                favorite_gold: resolve_color(&raw.semantic.extended.favorite_gold),
                // Chart colors
                chart_bg: resolve_color(&raw.semantic.extended.chart_bg),
                chart_axis_bg: resolve_color(&raw.semantic.extended.chart_axis_bg),
                chart_tooltip_bg: resolve_color(&raw.semantic.extended.chart_tooltip_bg),
                chart_text: resolve_color(&raw.semantic.extended.chart_text),
                chart_text_secondary: resolve_color(&raw.semantic.extended.chart_text_secondary),
                chart_text_muted: resolve_color(&raw.semantic.extended.chart_text_muted),
                chart_crosshair_label_bg: resolve_color(
                    &raw.semantic.extended.chart_crosshair_label_bg,
                ),
                // Trading colors
                bullish: resolve_color(&raw.semantic.extended.bullish),
                bearish: resolve_color(&raw.semantic.extended.bearish),
            },
            alert: AlertSemanticTokens {
                info_bg: resolve_color(&raw.semantic.alert.info_bg),
                info_border: resolve_color(&raw.semantic.alert.info_border),
                info_icon: resolve_color(&raw.semantic.alert.info_icon),
                success_bg: resolve_color(&raw.semantic.alert.success_bg),
                success_border: resolve_color(&raw.semantic.alert.success_border),
                success_icon: resolve_color(&raw.semantic.alert.success_icon),
                warning_bg: resolve_color(&raw.semantic.alert.warning_bg),
                warning_border: resolve_color(&raw.semantic.alert.warning_border),
                warning_icon: resolve_color(&raw.semantic.alert.warning_icon),
                error_bg: resolve_color(&raw.semantic.alert.error_bg),
                error_border: resolve_color(&raw.semantic.alert.error_border),
                error_icon: resolve_color(&raw.semantic.alert.error_icon),
            },
            modal: ModalSemanticTokens {
                overlay_bg: resolve_color(&raw.semantic.modal.overlay_bg),
                panel_bg: resolve_color(&raw.semantic.modal.panel_bg),
                panel_border: resolve_color(&raw.semantic.modal.panel_border),
                header_bg: resolve_color(&raw.semantic.modal.header_bg),
            },
            toast: ToastSemanticTokens {
                info_bg: resolve_color(&raw.semantic.toast.info_bg),
                info_icon: resolve_color(&raw.semantic.toast.info_icon),
                success_bg: resolve_color(&raw.semantic.toast.success_bg),
                success_icon: resolve_color(&raw.semantic.toast.success_icon),
                warning_bg: resolve_color(&raw.semantic.toast.warning_bg),
                warning_icon: resolve_color(&raw.semantic.toast.warning_icon),
                error_bg: resolve_color(&raw.semantic.toast.error_bg),
                error_icon: resolve_color(&raw.semantic.toast.error_icon),
                text: resolve_color(&raw.semantic.toast.text),
                shadow: resolve_color(&raw.semantic.toast.shadow),
                progress_bar_bg: resolve_color(&raw.semantic.toast.progress_bar_bg),
                progress_bar_fill: resolve_color(&raw.semantic.toast.progress_bar_fill),
            },
            command_palette: CommandPaletteSemanticTokens {
                bg: resolve_color(&raw.semantic.command_palette.bg),
                border: resolve_color(&raw.semantic.command_palette.border),
                input_bg: resolve_color(&raw.semantic.command_palette.input_bg),
                item_hover: resolve_color(&raw.semantic.command_palette.item_hover),
                item_selected: resolve_color(&raw.semantic.command_palette.item_selected),
                shortcut_text: resolve_color(&raw.semantic.command_palette.shortcut_text),
            },
        },
    }
}

/// Convert raw color to Color32
fn raw_color_to_color32(raw: &RawColor) -> Color32 {
    match raw {
        RawColor::Reference(_) => Color32::PLACEHOLDER, // Should not happen in palette
        RawColor::Rgb(r, g, b) => Color32::from_rgb(*r, *g, *b),
        RawColor::Rgba(r, g, b, a) => Color32::from_rgba_unmultiplied(*r, *g, *b, *a),
    }
}