← All widgets

Single Offer Widget – Dark Mode Cookie Test

Cookie Controls

Cookie key: userModeTheme

Current cookie value:

The widget polls the userModeTheme cookie every 500 ms and updates dark mode. Removing the cookie falls back to prefers-color-scheme.

Example 1 – Monthly offer, blue accent data-enable-darkmode + cookie key

data-enable-darkmode="true" · data-dark-mode-cookie-key="userModeTheme" · data-search-url set → shows "browse more offers" link

Example 2 – Green accent OS preference only, no cookie

data-enable-darkmode="true" · no data-dark-mode-cookie-key → follows OS preference only

Example 3 – Orange accent dark mode disabled

No data-enable-darkmode → widget always stays in light mode regardless of cookie or OS

Test scenarios

Data attributes

AttributeRequiredDescription
data-idUUID of the offer to display
data-partner-idPartner / subpartner ID
data-enable-darkmodetrue to enable dark mode (OS preference + optional cookie)
data-dark-mode-cookie-keyCookie name to poll for dark/light override (e.g. userModeTheme)
data-brand-colorAccent hex color (without #) used for price and CTA button
data-search-urlBase URL for "browse more offers" link. Hidden when omitted.
data-entity-typeDefaults to vehicle-offers