Skip to content

Add colors and radius embed options - #5

Draft
Max Musing (MaxMusing) wants to merge 1 commit into
mainfrom
cursor/embed-appearance-977f
Draft

Max Musing (MaxMusing) wants to merge 1 commit into
mainfrom
cursor/embed-appearance-977f

Conversation

@MaxMusing

Copy link
Copy Markdown
Member

SDK side of Basedash/charts#5998, which adds custom colors and corner radius to embeds.

API

<BasedashProvider
  fetchToken={fetchToken}
  colors={{ background: "#0b1a33", sidebarBackground: "#07122a", foreground: "#e8edf7", accent: "#ff7a1a", chart: [...] }}
  radius="small"
>
  <BasedashDashboards />
</BasedashProvider>
  • New types: EmbedColors (background required; sidebarBackground, foreground, accent, chart optional) and EmbedRadius (none / small / default / large). Both are new EmbedOptions fields.
  • Where they work: the provider (as defaults), every authenticated component, BasedashSharedDashboard (which falls back to an enclosing provider), and both URL builders.
  • Null vs undefined: colors={null} on a component opts back into Basedash's colors under a provider that sets them. Only undefined falls back to the provider.
  • Validation: colors are validated and normalized to 6-digit lowercase hex without #, so the URL needs no encoding. Invalid colors or more than nine chart colors throw TypeError.
  • Docs: README has a new "Matching your app's look" section, including the chart slot table (neutral, blue, orange, purple, red, teal, green, yellow, pink). The AI picks slots by these names, so embedders should keep each slot's meaning.

Contract

  • buildEmbedUrl always emits radius and color_background (default when colors is null), like every other session option, so dropping an option resets it instead of keeping the iframe session's value.
  • Optional color params are only emitted when set. The app replaces colors as a set, so omitting one means "derived".
  • buildSharedDashboardUrl only emits appearance params when colors or radius is passed, which keeps plain share links byte-identical.
  • BasedashSharedDashboard, which is always an iframe, always passes resolved values. Its default src therefore gains ?radius=default&color_background=default.
  • CONTRACT.md documents all of this.

Release

Minor changeset. Self-hosted instances on older Basedash releases ignore the new params.

Testing

pnpm check passes (typecheck, 44 tests, build, publint, attw). New tests cover:

  • serialization and normalization
  • omitted optional colors
  • invalid colors
  • shared-dashboard emission
  • provider inheritance and the null override
  • a fresh-token reload when colors change
Open in Web Open in Cursor 

Embeds accept a required background plus optional sidebar background,
foreground, accent, and chart colors, and a corner radius. Basedash derives
every other shade from them. buildEmbedUrl always emits radius and
color_background so a removed option resets instead of lingering in the
iframe session.

Co-authored-by: Max Musing <MaxMusing@users.noreply.github.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants