Styling
Match your site: a brand colour, light and dark, a see-through card.
The widget works without any of this. When you want it to match your site, these three cover most needs.
Use your brand colour
One value recolours the main button, the focus ring and the highlights. The text on the button is picked for contrast.
ts
config: { customColors: { "--tf-primary": "#2563eb" } }Different colours in light and dark
Give a table per theme. The widget uses the one for the theme on screen (including auto, which follows the visitor's system) and switches by itself. A theme without a table keeps the widget's own colours.
ts
config: {
customColors: {
light: { "--tf-primary": "#2563eb" },
dark: { "--tf-primary": "#93b4ff" },
},
}Let your page show through
Drop the card's fill and its edge, so your own background is behind the form.
ts
config: { noBackground: true, noBorder: true }Hide the "Powered by TokenFlight" line with hidePoweredBy: true. You can change the look at any time with widget.update({ config }); the new look replaces the old one.
Reference: every key
customColors uses the names of tokenflight-embed's customColors, so a map written for the swap widget can be reused. Radii and shadows are set here too.
Values
- Colours: a hex value,
rgb(),hsl(),oklch()(oroklab,lab,lch) ortransparent. - At most 64 characters per value (160 for shadows) and 40 keys.
- A map is either flat or
{ light, dark }; it cannot mix the two. - The SDK throws on a key or value outside this, so a typo shows in development. The widget drops such an entry on its own, so a value from elsewhere cannot add CSS to it.
--tf-accent, --tf-accent-light, --tf-accent-glow, --tf-primary-alpha, ...) are ignored without an error, so a map written for the swap widget can be passed as it is. Any other unknown key is refused.Arbitrary CSS and a stylesheet URL are deliberately not offered: a host-supplied stylesheet could restyle or hide what the page shows.