Repository navigation
Style: the base style is built from the tokens (#497 stage 2) - #499
Merged
Merged
Conversation
Tokens hold one theme's colours, but nothing said which: with_palette took the theme as an argument that "must be the theme they were made for", and Shadcn kept its own theme beside its tokens. Stage 2 builds a Style from tokens alone and needs the theme for shadcn's `dark:` classes (input fill, ghost hover, the kbd on a tooltip). - Tokens::theme, set by light() and dark(). - Tokens::with_palette(palette) reads it; its theme argument goes. - theme::warn_low_contrast(ctx, tokens) reads it; its theme argument goes. - Shadcn's `theme` field goes; Shadcn::theme() reads the tokens'. No behaviour change: every section and every part's resolved classes are identical before and after (checked with a throwaway dump). Breaking: Tokens::with_palette, theme::warn_low_contrast and the Shadcn::theme field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
Stage 2 of the shadcn-only epic. Core fills every section from shadcn's
tokens; the preset only writes its generated look over them.
- Style::new(&Tokens) fills every section the way Shadcn::style() did
(it moves here from the preset), in the tokens' theme, and writes the
widgets' own rules once, at the defaults layer. It carries the tokens'
font as the Fonts extension. Style::default() is Vega neutral light.
- Style::write_look(|sheet| ..) sets the preset layer, runs the closure,
then writes the recorded exceptions; write_exceptions is private.
Shadcn::style() is Style::new, write_look over the generated sheets,
the field sizes and its two own rules, and the disclosure exceptions.
- A layout with no style of its own draws with Style::default() in
egui's fonts (no font, control and label weights Normal), built once;
it gives egui nothing, as before.
- The 10 sections that had only getters and setters (label, checkbox,
radio, switch, segmented, select, menu, tooltip, input, table) are pub
fields; their getters go.
- size::{ICON, SM, XS, ..} move to eggshell_ui::theme::size; the shadcn
crate re-exports them.
- TablePart::last_row() and TablePart::striped_row(), beside
first_column(), so an app can rule the last row or a stripe.
- src/legacy_defaults.rs feeds the XDefaults writers from egui's default
visuals, so the Defaults layer under the preset is unchanged; it is
marked `#497 stage 3: delete`. 31 section fields that only feed rule
writers or exceptions are marked `#497 stage 3: move`/`delete`.
Deleted: Style::from_egui, the from_egui of ScrollStyle, SplitterStyle,
TableStyle and Tones, Style::derived's egui path, restyle,
rewrite_rules, the 10 section setters (set_select, set_input, set_menu,
set_table, set_label, set_checkbox, set_radio, set_switch,
set_segmented, set_tooltip), and the unused Sheet::set_layer and
has_rules_at.
Behaviour: under the preset nothing changes. Every section, extras
extension, egui style and part's resolved classes are identical before
and after (Vega/Lyra x light/dark, style() and layout_style()), and no
golden moved. Without a preset, a style is now Vega light, not egui's
look: its sections, motion and tones are shadcn's.
Tests deleted (they pinned the egui-derived look or the restyle path):
contract::core_draws_a_button_with_no_preset,
contract::the_neutral_input_maps_to_egui_s_own_text_edit_style,
numbers::an_infinite_egui_tooltip_delay_is_the_longest_duration,
tone::the_egui_style_takes_egui_s_warning_colour,
tone::the_egui_style_s_tones_pass_aa_but_for_the_listed_misses,
tooltips::the_neutral_style_takes_its_timing_and_width_from_egui,
owned_choice::the_neutral_style_draws_the_chosen_cell_in_egui_s_active_fill,
owned_choice::a_modified_style_changes_every_owned_widget,
menu_sheet::without_a_preset_the_highlighted_item_takes_egui_s_selection_fill,
modal::style::the_neutral_scrim_is_egui_modals_and_the_presets_is_black_at_half,
style::a_new_text_role_reaches_the_widgets_own_looks,
style::a_section_metric_an_exception_reads_lands_after_the_preset.
Breaking: the deleted items above; the sections' getters (now fields);
eggshell_ui_shadcn::size is a re-export.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 2 of #497: the base style is built from the tokens. Stacked on #498; merge that first. The diff against #498 deletes 1,931 lines and adds 1,154.
What changes
Style::new(&Tokens)fills every section the wayShadcn::style()did, intokens.theme.Style::default()is Vega light.Style::write_look(|sheet| …)writes the preset layer, then the recorded exceptions.Shadcn::style()is nowStyle::new+write_look+ the disclosure exceptions.with_paletteandwarn_low_contrastlose their theme argument, andShadcn.themebecomesShadcn::theme().Style::default()without its font, at regular weights. It installs no font and leaves egui's visuals alone.size::*moves toeggshell_ui::theme::size.TablePart::last_row()andTablePart::striped_row(), besidefirst_column().src/legacy_defaults.rsfeeds the old Defaults writers from egui's default visuals until stage 3 deletes both. It's marked// #497 stage 3: delete.Removed
Style::from_egui, plusScrollStyle::from_egui,SplitterStyle::from_eguiandTableStyle::from_egui.Style::rewrite_rules.write_exceptionsis now private.set_select…set_tooltip) and the 10 getters.Style::derived,restyle,Sheet::set_layer,Sheet::has_rules_at.Tests
Checks
cargo xtask integrate: green.style()andlayout_style(). Before and after are byte-identical, once source locations are stripped.For the user
kaolin_*,chrome_stacked_by_z) in Geist; that would be a follow-up PR.sizemodule doc;TODO(prose)placeholders on the new items.write_look,last_row,striped_row.🤖 Generated with Claude Code
https://claude.ai/code/session_01PWiKKfuwuKXZxdwsSBxd76