Skip to content

native-theme v0.5.9 — gpui-kit 0.6.6, per-side padding, iced widget styles

Choose a tag to compare

@tiborgats tiborgats released this 25 Sep 01:50
· 1902 commits to main since this release

Breaking Changes

native-theme

  • Padding is per side. WidgetBorderSpec's padding_horizontal / padding_vertical are replaced by padding_top, padding_right, padding_bottom and padding_left (Option<f32>; TOML padding_top_px …). padding_horizontal_px / padding_vertical_px stay as shorthand for both sides of their axis; stating an axis key together with one of its sides is a parse error.
  • ResolvedBorderSpec is split into ResolvedDefaultsBorder (defaults.border) and ResolvedWidgetBorder (every widget; padding: ResolvedPadding with Option<f32> sides). A widget border no longer carries corner_radius_lg or opacity.
  • An unstated size stays unstated. A padding side the theme does not state resolves to None (it was 0.0, which connectors applied over the toolkit's own padding). toolbar.bar_height, toolbar.item_gap, menu.row_height, list.row_height and combo_box.arrow_area_width are Option<f32>. A stated value below 0 is a validation error.
  • ResolvedFontSpec gains defined_size: Option<FontSize>, the size in the unit its source stated; FontSize implements Serialize / Deserialize.
  • Icon-theme detection reports its failure instead of naming a theme. system_icon_theme(), detect_icon_theme() and DetectionContext::icon_theme() return Result<String>; the error says which source failed and why. Resolved::icon_theme and SystemTheme::icon_theme are Option<Cow<'static, str>>. FreedesktopLoader with no theme and a failed detection loads nothing, except a custom IconProvider's own freedesktop SVG.
  • The empty public module native_theme::kde::metrics is removed.

native-theme-gpui

  • Requires gpui-component / gpui-base 0.6.6 and gpui-pre 0.3.6: gpui-component 0.6.2 removed ThemeColor::tiles in a patch release. The versions the connector was verified against are in its README.
  • reduce_motion: false no longer clears a reduced-motion flag the connector did not set; to switch motion back on, call cx.set_reduce_motion(false).
  • geometry::tooltip no longer sets a maximum width (see geometry::tooltip_content). With svg-rasterize (default) the icons functions return ImageSource::Render, which holds a sprite-atlas tile until handed to App::drop_image.
  • geometry::control_height and native_theme_gpui::dialog_content_padding are removed; geometry::input_height returns a StyleRefinement.
  • geometry builders set only the padding sides, heights and gaps the theme states, leaving the widget's own elsewhere.

native-theme-iced

  • font_size and mono_font_size take &AccessibilityPreferences; from_system returns the preferences as a fourth element.
  • iced's secondary.base carries the platform's placeholder colour (it was the button surface, which made placeholders invisible), and secondary.strong is a copy of it; container::secondary, progress_bar::secondary and button::secondary's hover change with it. Use styles::button for the platform's button colours.
  • background.base.text is defaults.text_color, no longer replaced by iced's readable().
  • button_padding and input_padding need the widgets feature (on by default); a side the theme does not state is iced's default padding, where it was 0.

Added

  • native-theme-iced: styles (feature widgets, default), 20 per-widget style functions for the states iced's palette has no slot for; styles::aw (feature iced_aw) for iced_aw's card, menu bar, tab bar, sidebar, selection list and spinner; padding_or and stated_padding; features widgets, iced_aw and the icon features (on by default, so load_icon works without enabling features on native-theme).
  • Both connectors: scaled_text_size(size, &prefs), a text size from the theme times the user's text-scaling factor.
  • native-theme-gpui: variants::ghost_button, a flat button that hovers and presses with the platform's button colours; geometry::tooltip_content, scrollbar_gutter, list, input_group_button and toolbar; geometry::dialog also carries the dialog's corner radius.
  • A Compatibility section in both connector READMEs: the upstream versions the crate requires and the dated set it was verified against.

Changed

  • Both connectors: status labels (success, danger, warning, gpui's info) are the platform's own colours; the white-or-black contrast enforcement is gone.
  • native-theme-gpui:
    • accent / accent_foreground take the platform's menu-hover pair, and sidebar_accent* the sidebar's selection pair.
    • link takes link.font.color, table_row_border takes list.grid_color, and geometry::icon_size_toolbar takes toolbar.icon_size.
    • ThemeColor mapping 139 → 138 fields, ThemeConfig export 127 → 126 (tiles is gone upstream).
  • native-theme-gpui geometry:
    • status_bar, tooltip, dialog_description, list_item, radio, select and title_bar also carry the platform's text colour, and button the label's font weight.
    • input, select and combobox apply the platform's padding sides.
    • button, input, select, combobox, menu_item and list_item follow one height rule: the stated height at a text-scaling factor up to 1, a minimum above it, with the platform's line height.
  • native-theme presets and readers: the native presets and OS readers state the paddings, toolbar sizes and row heights docs/platform-facts.md documents, and no others. For example, the Windows menu row is 23 (it was 36; the reader read the menu bar's SM_CYMENU), KDE states no menu or list row height, and the KDE status bar is padded 3/14/2/2. The colour-scheme presets, material and ios state none of these sizes.
  • native-theme: the KDE reader reads smallestReadableFont into text_scale.caption and derives the heading sizes from the body font, as Kirigami's Heading does.
  • Showcases: the gpui showcase is an application, with menus, a command palette and a Widget Info inspector. The iced showcase adds the iced_aw widgets. Both follow the chosen icon theme and reject command-line values they cannot honour.
  • Development: mapping-contract tests, a contrast invariant and showcase self-tests in both connectors, rendered seam tests in the gpui connector, a documented-sizes gate, a nightly dependency canary and scripts/check-features.sh (every crate in every feature combination).

Fixed

  • native-theme-gpui 0.5.8 no longer compiled on a fresh dependency resolution, after gpui-component 0.6.2 removed ThemeColor::tiles (fixed by the new version requirement).
  • native-theme:
    • A freedesktop icon comes only from the chosen theme or a theme its Inherits= chain declares, searched to the chain's end. hicolor, loose files in the icon directories and /usr/share/pixmaps no longer stand in for a missing icon.
    • A failed icon-theme detection no longer names hicolor (or material outside Linux, macOS, iOS and Windows).
  • native-theme: checkbox.indicator_color (the check mark and radio dot) inherits defaults.accent_text_color, not defaults.text_color, which put the window's text colour on the accent fill (as low as 1.12:1).
  • native-theme text, title and control sizes follow docs/platform-facts.md:
    • kde-breeze: caption 8pt (was 8.2), headings weight 400 (was 700), and no display.
    • macos-sonoma-live's text scale matches macOS's (e.g. dialog_title 22pt 400, was 15.6pt 700), and the -live presets' unsourced text-scale line heights are gone.
    • Dialog title fonts: macOS 13pt Bold, GNOME 15pt ExtraBold.
    • Windows progress track 1 (was 3), the Windows reader's slider thumb 18 (was 22), the macOS reader's slider track 5 (was 4).
  • native-theme: the Windows reader's metrics and fonts are logical pixels (font_dpi 96). They were device pixels above 100% scaling, so text resolved 1.5× too large at 150%.
  • native-theme: the Windows reader reads defaults.border.line_width (SM_CXBORDER) and the macOS reader defaults.border.color (separatorColor); the macOS reader no longer reports an invented text-scaling factor.
  • native-theme: system-icons builds on macOS and Windows, watch builds without portal, and watch with macos builds on macOS.
  • native-theme-gpui builds without svg-rasterize (SVGs are then handed to gpui undecoded).
  • native-theme-gpui:
    • A tooltip's text wraps inside its bubble, and a non-overlay scrollbar no longer covers the content.
    • Animated icons no longer flicker on their first frames.
    • Under reduce_transparency a dialog's overlay no longer turns the window black.
  • native-theme-gpui colours:
    • link_hover / link_active are the platform's link text colours (they were a 9%-alpha fill).
    • List and table headers take list.header_*, and the segmented tab bar's track segmented_control.background_color.
    • Layered hover and pressed colours (Windows 11) are composited over the button's fill.
  • native-theme-iced: to_theme's docs no longer list Tooltip among the widgets with a Catalog; native-theme-gpui: the docs of geometry::input_height, menu_item and dialog say what upstream applies.