From 5168e7b9b83e77a3e6313c2aeab90d328873898f Mon Sep 17 00:00:00 2001 From: Jamie Henson Date: Fri, 17 Jul 2026 13:42:06 +0100 Subject: [PATCH 1/2] feat(examples): add dark-mode styling to the example subprojects Convert every example variant (React + JavaScript, static markup and the dynamically-rendered .ts/.tsx markup) to render correctly in dark: hardcoded light Tailwind utilities gain `dark:` counterparts and custom CSS gets `.dark`-scoped overrides via the shadcn vars the examples already ship. Semantic and per-user colours (status dots, avatars, cursors, badge hues) are preserved. Co-Authored-By: Claude Opus 4.8 --- .../javascript/index.html | 10 ++++---- .../react/src/App.tsx | 10 ++++---- .../javascript/index.html | 8 +++---- .../react/src/App.tsx | 10 ++++---- .../auth-generate-jwt/javascript/index.html | 4 ++-- .../javascript/src/styles.css | 9 +++++++ examples/auth-generate-jwt/react/src/App.tsx | 8 +++---- .../react/src/styles/styles.css | 9 +++++++ .../auth-request-token/javascript/index.html | 4 ++-- .../javascript/src/styles.css | 9 +++++++ examples/auth-request-token/react/src/App.tsx | 8 +++---- .../react/src/styles/styles.css | 9 +++++++ examples/chat-presence/javascript/index.html | 2 +- .../chat-presence/javascript/src/script.ts | 2 +- .../chat-presence/javascript/src/styles.css | 4 ++++ examples/chat-presence/react/src/App.tsx | 4 ++-- .../chat-presence/react/src/styles/styles.css | 4 ++++ .../chat-room-history/javascript/index.html | 10 ++++---- .../javascript/src/script.ts | 6 ++--- examples/chat-room-history/react/src/Chat.tsx | 6 ++--- examples/chat-room-history/react/src/Home.tsx | 6 ++--- .../chat-room-messages/javascript/index.html | 2 +- .../javascript/src/script.ts | 2 +- .../javascript/src/styles.css | 4 ++++ examples/chat-room-messages/react/src/App.tsx | 4 ++-- .../react/src/styles/styles.css | 4 ++++ .../chat-room-reactions/javascript/index.html | 2 +- .../javascript/src/styles.css | 4 ++++ .../chat-room-reactions/react/src/App.tsx | 2 +- .../react/src/styles/styles.css | 4 ++++ .../chat-ui-chat-window/react/src/App.tsx | 2 +- examples/chat-ui-sidebar/react/src/App.tsx | 2 +- .../javascript/index.html | 18 +++++++------- .../javascript/src/styles.css | 5 ++++ .../javascript/index.html | 4 ++-- .../javascript/src/script.ts | 2 +- .../javascript/src/styles.css | 5 ++++ .../javascript/index.html | 2 +- .../javascript/src/script.ts | 2 +- .../javascript/src/styles.css | 4 ++++ .../react/src/App.tsx | 6 ++--- .../react/src/styles/styles.css | 4 ++++ .../javascript/index.html | 2 +- .../javascript/src/styles.css | 4 ++++ .../pub-sub-channel-state/react/src/App.tsx | 4 ++-- .../react/src/styles/styles.css | 4 ++++ .../pub-sub-history/javascript/index.html | 16 ++++++------- .../pub-sub-history/javascript/src/script.ts | 2 +- .../pub-sub-history/react/src/Auction.tsx | 10 ++++---- examples/pub-sub-history/react/src/Home.tsx | 4 ++-- .../react/src/styles/styles.css | 4 ++++ .../javascript/index.html | 2 +- .../javascript/src/components/annotations.ts | 10 ++++---- .../javascript/src/components/details.ts | 8 +++---- .../javascript/src/components/message.ts | 6 ++--- .../javascript/src/components/summary.ts | 24 +++++++++---------- .../javascript/src/styles.css | 4 ++++ .../javascript/index.html | 2 +- .../react/src/App.tsx | 8 +++---- .../pub-sub-occupancy/javascript/index.html | 2 +- .../javascript/src/styles.css | 4 ++++ examples/pub-sub-occupancy/react/src/App.tsx | 2 +- .../pub-sub-presence/javascript/index.html | 2 +- .../pub-sub-presence/javascript/src/script.ts | 2 +- examples/pub-sub-presence/react/src/App.tsx | 4 ++-- .../react/src/styles/styles.css | 4 ++++ examples/pub-sub-rewind/javascript/index.html | 16 ++++++------- .../pub-sub-rewind/javascript/src/script.ts | 2 +- examples/pub-sub-rewind/react/src/Home.tsx | 4 ++-- examples/pub-sub-rewind/react/src/Odds.tsx | 14 +++++------ .../javascript/src/script.ts | 2 +- .../react/src/components/Avatar.tsx | 4 ++-- .../react/src/styles/styles.css | 4 ++++ .../javascript/src/script.ts | 12 +++++----- .../react/src/components/InputCell.tsx | 10 ++++---- .../react/src/styles/styles.css | 4 ++++ .../spaces-live-cursors/javascript/index.html | 2 +- .../spaces-live-cursors/react/src/App.tsx | 2 +- .../react/src/styles/styles.css | 4 ++++ .../javascript/index.html | 2 +- .../javascript/src/script.ts | 8 +++---- .../react/src/components/Cell.tsx | 6 ++--- .../react/src/components/Spreadsheet.tsx | 4 ++-- .../react/src/styles/styles.css | 4 ++++ 84 files changed, 291 insertions(+), 173 deletions(-) diff --git a/examples/ai-transport-message-per-response/javascript/index.html b/examples/ai-transport-message-per-response/javascript/index.html index b002b18e24..7276edbe7b 100644 --- a/examples/ai-transport-message-per-response/javascript/index.html +++ b/examples/ai-transport-message-per-response/javascript/index.html @@ -7,15 +7,15 @@ AI Transport Message Per Response - JavaScript - +
-
+
- + Ready @@ -24,7 +24,7 @@
-
+
Select a prompt below to get started
@@ -36,7 +36,7 @@
diff --git a/examples/ai-transport-message-per-response/react/src/App.tsx b/examples/ai-transport-message-per-response/react/src/App.tsx index 07bb4b730b..6e9f3852bb 100644 --- a/examples/ai-transport-message-per-response/react/src/App.tsx +++ b/examples/ai-transport-message-per-response/react/src/App.tsx @@ -92,9 +92,9 @@ const AITransportDemo: React.FC = () => { {/* Response section with always visible status */}
-
+
- + {
-
+
{currentResponse || 'Select a prompt below to get started'}
@@ -125,8 +125,8 @@ const AITransportDemo: React.FC = () => { disabled={connectionState !== 'connected' || isChannelDetached} className={`px-3 py-2 text-sm border rounded-md transition-colors ${ connectionState !== 'connected' || isChannelDetached - ? 'bg-gray-100 text-gray-400 cursor-not-allowed border-gray-200' - : 'bg-white hover:bg-blue-50 border-gray-300 hover:border-blue-300 cursor-pointer' + ? 'bg-gray-100 dark:bg-gray-800 text-gray-400 dark:text-gray-500 cursor-not-allowed border-gray-200 dark:border-gray-700' + : 'bg-white dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-950 border-gray-300 dark:border-gray-700 hover:border-blue-300 dark:hover:border-blue-700 cursor-pointer' }`} > What is Ably AI Transport? diff --git a/examples/ai-transport-message-per-token/javascript/index.html b/examples/ai-transport-message-per-token/javascript/index.html index 0d6a7baa7f..cef0a693ac 100644 --- a/examples/ai-transport-message-per-token/javascript/index.html +++ b/examples/ai-transport-message-per-token/javascript/index.html @@ -7,15 +7,15 @@ AI Transport Token Streaming - JavaScript - +
-
+
- + ready @@ -24,7 +24,7 @@
-
+
Select a prompt below to get started
diff --git a/examples/ai-transport-message-per-token/react/src/App.tsx b/examples/ai-transport-message-per-token/react/src/App.tsx index c7ecc026ee..39afdd3e4d 100644 --- a/examples/ai-transport-message-per-token/react/src/App.tsx +++ b/examples/ai-transport-message-per-token/react/src/App.tsx @@ -115,9 +115,9 @@ const AITransportDemo: React.FC = () => { {/* Response section with always visible status */}
-
+
- + {
-
+
{currentResponse || (isProcessing ? 'Thinking...' : 'Select a prompt below to get started')} {isProcessing && }
@@ -157,8 +157,8 @@ const AITransportDemo: React.FC = () => { disabled={isProcessing || connectionState !== 'connected' || isChannelDetached} className={`px-3 py-2 text-sm border rounded-md transition-colors ${ isProcessing || connectionState !== 'connected' || isChannelDetached - ? 'bg-gray-100 text-gray-400 cursor-not-allowed border-gray-200' - : 'bg-white hover:bg-blue-50 border-gray-300 hover:border-blue-300 cursor-pointer' + ? 'bg-gray-100 dark:bg-gray-800 text-gray-400 dark:text-gray-500 cursor-not-allowed border-gray-200 dark:border-gray-700' + : 'bg-white dark:bg-gray-900 hover:bg-blue-50 dark:hover:bg-blue-950 border-gray-300 dark:border-gray-700 hover:border-blue-300 dark:hover:border-blue-700 cursor-pointer' }`} > What is Ably AI Transport? diff --git a/examples/auth-generate-jwt/javascript/index.html b/examples/auth-generate-jwt/javascript/index.html index f6fe86e515..ceb9571dce 100644 --- a/examples/auth-generate-jwt/javascript/index.html +++ b/examples/auth-generate-jwt/javascript/index.html @@ -8,8 +8,8 @@ Authentication to Ably with JWT -
-
+
+

Authentication to Ably with JWT diff --git a/examples/auth-generate-jwt/javascript/src/styles.css b/examples/auth-generate-jwt/javascript/src/styles.css index 8c7be91507..bfe99b78ee 100644 --- a/examples/auth-generate-jwt/javascript/src/styles.css +++ b/examples/auth-generate-jwt/javascript/src/styles.css @@ -98,3 +98,12 @@ input { outline: none; transition: all 0.2s ease-in-out; } + +.dark .container { + background-color: hsl(var(--background)); +} + +.dark input { + background-color: hsl(var(--input)); + color: hsl(var(--foreground)); +} diff --git a/examples/auth-generate-jwt/react/src/App.tsx b/examples/auth-generate-jwt/react/src/App.tsx index dde24b5b04..d7c6d13c5b 100644 --- a/examples/auth-generate-jwt/react/src/App.tsx +++ b/examples/auth-generate-jwt/react/src/App.tsx @@ -23,8 +23,8 @@ const StatusMessages = ({ messages, setMessages }: StatusMessagesProps) => { }); return ( -
-
+
+

Authentication to Ably with a JWT

The Ably client has been successfully initialized.

@@ -89,8 +89,8 @@ export default function App() { } return ( -
-
+
+

Authentication to Ably with a JWT

Press the Connect button to initialize the client:

diff --git a/examples/auth-generate-jwt/react/src/styles/styles.css b/examples/auth-generate-jwt/react/src/styles/styles.css index f5fbac7a2b..ee68679f38 100644 --- a/examples/auth-generate-jwt/react/src/styles/styles.css +++ b/examples/auth-generate-jwt/react/src/styles/styles.css @@ -78,3 +78,12 @@ input { outline: none; transition: all 0.2s ease-in-out; } + +.dark .container { + background-color: hsl(var(--background)); +} + +.dark input { + background-color: hsl(var(--input)); + color: hsl(var(--foreground)); +} diff --git a/examples/auth-request-token/javascript/index.html b/examples/auth-request-token/javascript/index.html index 20e112099b..af57895824 100644 --- a/examples/auth-request-token/javascript/index.html +++ b/examples/auth-request-token/javascript/index.html @@ -8,8 +8,8 @@ Generate Token -
-
+
+

Authentication with Ably diff --git a/examples/auth-request-token/javascript/src/styles.css b/examples/auth-request-token/javascript/src/styles.css index f5fbac7a2b..ee68679f38 100644 --- a/examples/auth-request-token/javascript/src/styles.css +++ b/examples/auth-request-token/javascript/src/styles.css @@ -78,3 +78,12 @@ input { outline: none; transition: all 0.2s ease-in-out; } + +.dark .container { + background-color: hsl(var(--background)); +} + +.dark input { + background-color: hsl(var(--input)); + color: hsl(var(--foreground)); +} diff --git a/examples/auth-request-token/react/src/App.tsx b/examples/auth-request-token/react/src/App.tsx index 62c83dac86..0fc0791491 100644 --- a/examples/auth-request-token/react/src/App.tsx +++ b/examples/auth-request-token/react/src/App.tsx @@ -23,8 +23,8 @@ const StatusMessages = ({ messages, setMessages }: StatusMessagesProps) => { }); return ( -
-
+
+

Authentication with Ably

The Ably client has been successfully initialized.

@@ -92,8 +92,8 @@ export default function App() { } return ( -
-
+
+

Authentication with Ably

Press the Connect button to initialize the client:

diff --git a/examples/auth-request-token/react/src/styles/styles.css b/examples/auth-request-token/react/src/styles/styles.css index f5fbac7a2b..ee68679f38 100644 --- a/examples/auth-request-token/react/src/styles/styles.css +++ b/examples/auth-request-token/react/src/styles/styles.css @@ -78,3 +78,12 @@ input { outline: none; transition: all 0.2s ease-in-out; } + +.dark .container { + background-color: hsl(var(--background)); +} + +.dark input { + background-color: hsl(var(--input)); + color: hsl(var(--foreground)); +} diff --git a/examples/chat-presence/javascript/index.html b/examples/chat-presence/javascript/index.html index 9ec32049aa..1bef81af88 100644 --- a/examples/chat-presence/javascript/index.html +++ b/examples/chat-presence/javascript/index.html @@ -11,7 +11,7 @@ -
+
diff --git a/examples/chat-presence/javascript/src/script.ts b/examples/chat-presence/javascript/src/script.ts index ec2a18a511..caed2c480d 100644 --- a/examples/chat-presence/javascript/src/script.ts +++ b/examples/chat-presence/javascript/src/script.ts @@ -91,7 +91,7 @@ async function addCard(onlineStatus: PresenceMember) { // Create an element to store status items const card = document.createElement('div'); card.className = - 'flex items-center p-4 bg-gray-100 rounded-lg shadow-sm hover:shadow-md transition-shadow duration-200'; + 'flex items-center p-4 bg-gray-100 dark:bg-gray-800 rounded-lg shadow-sm hover:shadow-md transition-shadow duration-200'; card.id = onlineStatus.clientId; // Create element to store online status diff --git a/examples/chat-presence/javascript/src/styles.css b/examples/chat-presence/javascript/src/styles.css index dcfe1df2d8..24ecc25570 100644 --- a/examples/chat-presence/javascript/src/styles.css +++ b/examples/chat-presence/javascript/src/styles.css @@ -69,6 +69,10 @@ height: 100vh; } +.dark .container { + background-color: hsl(var(--background)); +} + .away-button { margin-top: 1rem; padding: 0.5rem 1rem; diff --git a/examples/chat-presence/react/src/App.tsx b/examples/chat-presence/react/src/App.tsx index c1cd951056..fce2a050ad 100644 --- a/examples/chat-presence/react/src/App.tsx +++ b/examples/chat-presence/react/src/App.tsx @@ -29,12 +29,12 @@ const Online = () => { }); return ( -
+
{presenceData.map((onlineStatus) => (
-
-
+
+

Use the 'Send message' button to send 5 messages before you enter and subscribe to the chat room.

@@ -21,7 +21,7 @@

Use the 'Send message' button to send 5 mes Send message @@ -30,7 +30,7 @@

Use the 'Send message' button to send 5 mes

Place bid -
+

Current bid

-

No bids yet.

+

No bids yet.

@@ -61,7 +61,7 @@

Place your bid

diff --git a/examples/pub-sub-message-annotations/javascript/src/components/annotations.ts b/examples/pub-sub-message-annotations/javascript/src/components/annotations.ts index 7283aa2d00..7d1b464780 100644 --- a/examples/pub-sub-message-annotations/javascript/src/components/annotations.ts +++ b/examples/pub-sub-message-annotations/javascript/src/components/annotations.ts @@ -27,7 +27,7 @@ function createAnnotationItem(annotation: Annotation) { const { color, label } = findAnnotationType(typeKey); const item = document.createElement('div'); - item.className = `pl-3 pr-2 py-2 border-l-4 border-l-${color}-500 border-y border-r border-gray-200 bg-white shadow-sm flex flex-wrap items-center`; + item.className = `pl-3 pr-2 py-2 border-l-4 border-l-${color}-500 border-y border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm flex flex-wrap items-center`; item.setAttribute('data-id', annotation.id); item.setAttribute('data-timestamp', annotation.timestamp.toString()); item.setAttribute('data-serial', annotation.messageSerial); @@ -41,12 +41,12 @@ function createAnnotationItem(annotation: Annotation) { leftContent.className = 'flex items-center gap-2 min-w-0 flex-grow'; const typeLabel = document.createElement('span'); - typeLabel.className = `text-sm font-medium text-${color}-800`; + typeLabel.className = `text-sm font-medium text-${color}-800 dark:text-${color}-200`; typeLabel.textContent = label; leftContent.appendChild(typeLabel); const valueContent = document.createElement('span'); - valueContent.className = 'text-sm text-gray-700 overflow-hidden text-ellipsis'; + valueContent.className = 'text-sm text-gray-700 dark:text-gray-300 overflow-hidden text-ellipsis'; valueContent.textContent = annotation.name || 'unknown'; leftContent.appendChild(valueContent); @@ -86,7 +86,7 @@ function createAnnotationItem(annotation: Annotation) { rightContent.appendChild(clientBadge); const timestamp = document.createElement('div'); - timestamp.className = 'text-xs text-gray-500'; + timestamp.className = 'text-xs text-gray-500 dark:text-gray-400'; timestamp.textContent = formatTimestamp(annotation.timestamp); rightContent.appendChild(timestamp); @@ -106,7 +106,7 @@ export function createAnnotationsListElement(messageSerial: string) { annotationsList.setAttribute('data-message-serial', messageSerial); const emptyState = document.createElement('div'); - emptyState.className = 'text-center p-2 text-gray-500 text-sm'; + emptyState.className = 'text-center p-2 text-gray-500 dark:text-gray-400 text-sm'; emptyState.textContent = 'No annotations received yet.'; emptyState.id = `annotations-empty-${messageSerial}`; diff --git a/examples/pub-sub-message-annotations/javascript/src/components/details.ts b/examples/pub-sub-message-annotations/javascript/src/components/details.ts index 104987c9b3..47ffc88597 100644 --- a/examples/pub-sub-message-annotations/javascript/src/components/details.ts +++ b/examples/pub-sub-message-annotations/javascript/src/components/details.ts @@ -6,17 +6,17 @@ import { createAnnotationsListElement } from './annotations'; export function createPublishAnnotationElement(message: MessageWithSerial) { const publisher = document.createElement('div'); - publisher.className = 'p-2 border-b border-gray-200 bg-gray-50'; + publisher.className = 'p-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900'; publisher.innerHTML = `
- - +
`; @@ -116,7 +116,7 @@ export function createMessageDetailsElement(message: MessageWithSerial) { export function createDetailsPane(message: MessageWithSerial) { const detailsPane = document.createElement('div'); - detailsPane.className = 'border-b border-l border-r border-gray-200 rounded-b-md overflow-hidden bg-white shadow-sm'; + detailsPane.className = 'border-b border-l border-r border-gray-200 dark:border-gray-700 rounded-b-md overflow-hidden bg-white dark:bg-gray-900 shadow-sm'; detailsPane.id = `details-${message.id}`; const messageDetails = createMessageDetailsElement(message); diff --git a/examples/pub-sub-message-annotations/javascript/src/components/message.ts b/examples/pub-sub-message-annotations/javascript/src/components/message.ts index cab5dd7af5..cc2f22b590 100644 --- a/examples/pub-sub-message-annotations/javascript/src/components/message.ts +++ b/examples/pub-sub-message-annotations/javascript/src/components/message.ts @@ -17,7 +17,7 @@ export function createMessageElement(message: MessageWithSerial) { // Main message element that can be clicked to expand const messageElement = document.createElement('div'); - messageElement.className = `px-3 py-2 border-t border-l border-r border-gray-200 rounded-t-md bg-white shadow-sm cursor-pointer`; + messageElement.className = `px-3 py-2 border-t border-l border-r border-gray-200 dark:border-gray-700 rounded-t-md bg-white dark:bg-gray-900 shadow-sm cursor-pointer`; messageElement.id = `message-${message.id}`; // First row: message text (left aligned) and dropdown arrow (right aligned) @@ -25,7 +25,7 @@ export function createMessageElement(message: MessageWithSerial) { firstRow.className = 'flex justify-between items-center w-full'; const messageContent = document.createElement('div'); - messageContent.className = 'flex-grow text-sm font-medium text-gray-700 overflow-hidden text-ellipsis'; + messageContent.className = 'flex-grow text-sm font-medium text-gray-700 dark:text-gray-300 overflow-hidden text-ellipsis'; messageContent.textContent = message.data; firstRow.appendChild(messageContent); @@ -44,7 +44,7 @@ export function createMessageElement(message: MessageWithSerial) { clientBadge.classList.add('shrink-0'); const timestamp = document.createElement('div'); - timestamp.className = 'text-xs text-gray-500'; + timestamp.className = 'text-xs text-gray-500 dark:text-gray-400'; timestamp.textContent = formatTimestamp(message.timestamp || Date.now()); secondRow.appendChild(clientBadge); diff --git a/examples/pub-sub-message-annotations/javascript/src/components/summary.ts b/examples/pub-sub-message-annotations/javascript/src/components/summary.ts index 00066e2cc8..513a4f3841 100644 --- a/examples/pub-sub-message-annotations/javascript/src/components/summary.ts +++ b/examples/pub-sub-message-annotations/javascript/src/components/summary.ts @@ -14,7 +14,7 @@ import { getAnnotationTypeKey } from './annotations'; function createEmptyAnnotationSummaryContentElement() { const emptyState = document.createElement('div'); - emptyState.className = 'text-center py-2 text-gray-500 text-sm'; + emptyState.className = 'text-center py-2 text-gray-500 dark:text-gray-400 text-sm'; emptyState.textContent = 'Publish an annotation to view summaries.'; return emptyState; } @@ -34,7 +34,7 @@ function createLabelContainer(label: string, color: string) { container.className = 'flex items-center'; const labelSpan = document.createElement('span'); - labelSpan.className = `text-sm font-medium text-${color}-800`; + labelSpan.className = `text-sm font-medium text-${color}-800 dark:text-${color}-200`; labelSpan.textContent = label; container.appendChild(labelSpan); @@ -45,7 +45,7 @@ function createSectionHeader(key: string, entry: Ably.SummaryEntry) { const typeKey = getAnnotationTypeKey(key); const { color, label } = findAnnotationType(typeKey); const sectionHeader = document.createElement('div'); - sectionHeader.className = `border-l-4 border-l-${color}-500 border-t border-r border-gray-200 bg-white shadow-sm px-3 py-1.5 ${typeKey === 'total.v1' ? '' : 'cursor-pointer'}`; + sectionHeader.className = `border-l-4 border-l-${color}-500 border-t border-r border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm px-3 py-1.5 ${typeKey === 'total.v1' ? '' : 'cursor-pointer'}`; const wrapper = document.createElement('div'); wrapper.className = 'flex justify-between items-center'; @@ -66,7 +66,7 @@ function createSectionHeader(key: string, entry: Ably.SummaryEntry) { labelContainer.appendChild(createCountBadge(count, color)); const valueLabel = document.createElement('span'); - valueLabel.className = `ml-1 text-xs text-gray-600`; + valueLabel.className = `ml-1 text-xs text-gray-600 dark:text-gray-300`; labelContainer.appendChild(valueLabel); wrapper.appendChild(labelContainer); @@ -79,7 +79,7 @@ function createSectionHeader(key: string, entry: Ably.SummaryEntry) { function createFlagCard(entry: Ably.SummaryClientIdList, color: string) { const card = document.createElement('div'); - card.className = 'p-3 bg-white flex items-center gap-2'; + card.className = 'p-3 bg-white dark:bg-gray-900 flex items-center gap-2'; // Add empty spacer for alignment const spacer = document.createElement('span'); @@ -101,11 +101,11 @@ function createFlagCard(entry: Ably.SummaryClientIdList, color: string) { function createDistinctUniqueCard(value: string, entry: Ably.SummaryClientIdList, color: string) { const card = document.createElement('div'); - card.className = 'p-3 bg-white flex items-center gap-2'; + card.className = 'p-3 bg-white dark:bg-gray-900 flex items-center gap-2'; // Add value text const valueContent = document.createElement('span'); - valueContent.className = 'text-sm text-gray-700 flex-shrink-0 mr-auto'; + valueContent.className = 'text-sm text-gray-700 dark:text-gray-300 flex-shrink-0 mr-auto'; valueContent.textContent = value; card.appendChild(valueContent); @@ -124,11 +124,11 @@ function createDistinctUniqueCard(value: string, entry: Ably.SummaryClientIdList function createMultipleCard(value: string, entry: Ably.SummaryMultipleValues[string], color: string) { const card = document.createElement('div'); - card.className = 'p-3 bg-white flex items-center gap-2'; + card.className = 'p-3 bg-white dark:bg-gray-900 flex items-center gap-2'; // Add value text const valueContent = document.createElement('span'); - valueContent.className = 'text-sm text-gray-700 flex-shrink-0 mr-auto'; + valueContent.className = 'text-sm text-gray-700 dark:text-gray-300 flex-shrink-0 mr-auto'; valueContent.textContent = value; card.appendChild(valueContent); @@ -156,7 +156,7 @@ function createSectionContent(fullTypeKey: string, entry: Ably.SummaryEntry) { const typeKey = getAnnotationTypeKey(fullTypeKey); const { color } = findAnnotationType(typeKey); const sectionContent = document.createElement('div'); - sectionContent.className = `overflow-hidden border-l-4 border-l-${color}-500 border-b border-r border-gray-200`; + sectionContent.className = `overflow-hidden border-l-4 border-l-${color}-500 border-b border-r border-gray-200 dark:border-gray-700`; if (typeKey === 'flag.v1') { const card = createFlagCard(entry as Ably.SummaryClientIdList, color); @@ -167,7 +167,7 @@ function createSectionContent(fullTypeKey: string, entry: Ably.SummaryEntry) { const [value, info] = entryData; const card = createDistinctUniqueCard(value, info, color); if (index < entries.length - 1) { - card.classList.add('border-b', 'border-gray-100'); + card.classList.add('border-b', 'border-gray-100', 'dark:border-gray-700'); } sectionContent.appendChild(card); }); @@ -177,7 +177,7 @@ function createSectionContent(fullTypeKey: string, entry: Ably.SummaryEntry) { const [value, info] = entryData; const card = createMultipleCard(value, info, color); if (index < entries.length - 1) { - card.classList.add('border-b', 'border-gray-100'); + card.classList.add('border-b', 'border-gray-100', 'dark:border-gray-700'); } sectionContent.appendChild(card); }); diff --git a/examples/pub-sub-message-annotations/javascript/src/styles.css b/examples/pub-sub-message-annotations/javascript/src/styles.css index 562e9ac776..da6e6287c9 100644 --- a/examples/pub-sub-message-annotations/javascript/src/styles.css +++ b/examples/pub-sub-message-annotations/javascript/src/styles.css @@ -69,6 +69,10 @@ height: 100vh; } +.dark .container { + background-color: hsl(var(--background)); +} + .inner { width: 100%; max-width: 320px; diff --git a/examples/pub-sub-message-encryption/javascript/index.html b/examples/pub-sub-message-encryption/javascript/index.html index c99f196112..edb945158f 100644 --- a/examples/pub-sub-message-encryption/javascript/index.html +++ b/examples/pub-sub-message-encryption/javascript/index.html @@ -15,7 +15,7 @@

Client without an encr

-
+
diff --git a/examples/pub-sub-message-encryption/react/src/App.tsx b/examples/pub-sub-message-encryption/react/src/App.tsx index f82a97380c..a186bc3899 100644 --- a/examples/pub-sub-message-encryption/react/src/App.tsx +++ b/examples/pub-sub-message-encryption/react/src/App.tsx @@ -50,10 +50,10 @@ function EncodedMessages() {
-
+
{messages.map((msg, index) => ( -
+
{msg}
))} @@ -101,10 +101,10 @@ function DecodedMessages() {
-
+
{messages.map((msg, index) => ( -
+
{msg.data}
))} diff --git a/examples/pub-sub-occupancy/javascript/index.html b/examples/pub-sub-occupancy/javascript/index.html index 1e2796d16e..fda901869b 100644 --- a/examples/pub-sub-occupancy/javascript/index.html +++ b/examples/pub-sub-occupancy/javascript/index.html @@ -11,7 +11,7 @@
-
+
diff --git a/examples/pub-sub-occupancy/javascript/src/styles.css b/examples/pub-sub-occupancy/javascript/src/styles.css index 94b4f84544..32d359adfa 100644 --- a/examples/pub-sub-occupancy/javascript/src/styles.css +++ b/examples/pub-sub-occupancy/javascript/src/styles.css @@ -69,6 +69,10 @@ height: 100vh; } +.dark .container { + background-color: hsl(var(--background)); +} + .uk-text-primary { color: hsl(var(--primary)); } diff --git a/examples/pub-sub-occupancy/react/src/App.tsx b/examples/pub-sub-occupancy/react/src/App.tsx index 8bacee4da9..cccba11f3d 100644 --- a/examples/pub-sub-occupancy/react/src/App.tsx +++ b/examples/pub-sub-occupancy/react/src/App.tsx @@ -23,7 +23,7 @@ function Stream() { return (
-
+