Skip to content

refactor: scoped theme contracts for navbar and sidebar chrome#4518

Open
adrianthedev wants to merge 1 commit into
4-devfrom
refactor/prep-for-theming
Open

refactor: scoped theme contracts for navbar and sidebar chrome#4518
adrianthedev wants to merge 1 commit into
4-devfrom
refactor/prep-for-theming

Conversation

@adrianthedev
Copy link
Copy Markdown
Collaborator

@adrianthedev adrianthedev commented May 29, 2026

Summary

Prep work for full chrome theming. Today the navbar and sidebar are painted with hard-coded primitive neutral tokens (--color-avo-neutral-800, etc.), which means an install can't recolor the chrome without overriding the global palette and affecting everything else. This PR carves out scoped CSS variable contracts on .top-navbar and .avo-sidebar so each region owns its own palette and can be re-themed in isolation — popovers, dropdowns, and main content keep using their own surface tokens.

What changed

  • Top navbar contract (layout.css) — every navbar surface (search input, header links, sidebar toggle, controls) now reads from --top-navbar-* variables defined on .top-navbar. Defaults map to the existing neutral palette, so the rendered result is unchanged. --color-navbar-background is kept as the global override knob feeding the scoped --top-navbar-background.
  • Sidebar contract (sidebar.css) — sidebar background, borders, content, link hover/active, focus, and profile avatar now read from --sidebar-* variables on .avo-sidebar, replacing inline @apply text-content / color-mix usage.
  • Color scheme switcher (color_scheme_switcher.css) — inline pill and compact trigger consume the navbar control tokens instead of fixed neutrals.
  • Main content corners (layout.css + variables.css) — new --main-content-radius and a --top-navbar-start-notch-align-with-main-content flag, driven by @container style(...) queries, let layouts align the navbar's start notch with the content panel edge. Adds a focus-visible outline on the main content panel.
  • Dummy-app theme examplesavo_theme_canvas.css (chrome blends into the page background in light/dark) and avo_theme_coastal.css (custom teal palette), wired into the head partial as commented-out stylesheet_link_tags to demonstrate the ejection-based retheming flow.
  • Minor comment cleanups (em-dashes → periods) and switched a few left/right rules to logical inset-inline for RTL.

No behavioral change to the default theme — defaults resolve to the current palette. The contracts are the new public surface for theming.

Test plan

Visual check in the dummy app: uncomment one of the stylesheet_link_tag lines in spec/dummy/app/views/avo/partials/_head.html.erb and confirm the navbar/sidebar re-theme correctly in both light and dark mode, with the default (no extra stylesheet) appearance unchanged.


Compound Engineering v2.59.0
🤖 Generated with Claude Opus 4.8 (1M context, extended thinking) via Claude Code


Note

Low Risk
Styling-only refactor with defaults mapped to the existing palette; main visual risk is subtle layout/notch or RTL regressions without automated CSS coverage.

Overview
Introduces scoped CSS theme contracts on .top-navbar and .avo-sidebar so navbar and sidebar chrome can be recolored without touching global neutral tokens. Navbar search, header links, sidebar toggle, and color-scheme switcher triggers now read --top-navbar-* (defaults preserve today’s neutrals); sidebar links, profile, and status chrome read --sidebar-*.

Adds layout knobs --main-content-radius and --top-navbar-start-notch-align-with-main-content, with @container style(...) rules so main content top radii and the start navbar notch can align with the content edge; drops the desktop rule that forced rounded-ss-none when the sidebar is open. Small polish: breadcrumb fade pseudo-elements use inset-inline, main content gets a focus-visible outline, and the dummy app ships commented canvas / coastal theme stylesheets demonstrating overrides via the head partial.

Reviewed by Cursor Bugbot for commit 488ccc8. Bugbot is set up for automated code reviews on this repo. Configure here.

Introduce overridable CSS variable contracts on `.top-navbar` and
`.avo-sidebar` so installs can recolor the chrome locally without
touching the primitive neutral palette. Add main-content corner radius
knobs driven by container-style queries (navbar notch alignment), a
focus-visible outline on the main content panel, and two dummy-app theme
examples (canvas, coastal) demonstrating end-to-end retheming.
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 488ccc8. Configure here.


@container style(--navbar-notch-enabled: true) and style(--top-navbar-start-notch-align-with-main-content: true) {
--main-content-start-radius: var(--main-content-radius);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Start corner radius regression when sidebar is closed

Medium Severity

The --main-content-start-radius defaults to 0px and only becomes rounded when both --navbar-notch-enabled: true AND --top-navbar-start-notch-align-with-main-content: true. Since the latter defaults to false, the start-start corner is always flat. Previously, it was always rounded via rounded-ss-(--navbar-notch-radius) and only flattened by the now-removed .sidebar-open .main-content { rounded-ss-none } rule. This means when the sidebar is closed on desktop or on mobile, the content's start corner is flat but the start notch (::before) is still visible at position 0, creating a visual mismatch that didn't exist before. The PR states "No behavioral change to the default theme" but this changes the geometry.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 488ccc8. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant