From fb7d43612ec464cf164a779cd84362a45bf479e9 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Wed, 2 Apr 2025 21:20:14 +1100 Subject: [PATCH 1/4] Add new Theme Color content feature --- injected/docs/theme-color.md | 30 ++++++++ .../config/theme-color-absent.json | 6 ++ .../config/theme-color-disabled.json | 9 +++ .../config/theme-color-enabled.json | 9 +++ .../test-pages/theme-color/index.html | 11 +++ .../test-pages/theme-color/media-queries.html | 13 ++++ .../theme-color/no-theme-color.html | 10 +++ injected/integration-test/theme-color.spec.js | 77 +++++++++++++++++++ injected/playwright.config.js | 7 +- injected/src/features.js | 5 +- injected/src/features/theme-color.js | 44 +++++++++++ .../theme-color/themeColorFound.notify.json | 16 ++++ injected/src/types/theme-color.ts | 37 +++++++++ injected/src/utils.js | 2 +- 14 files changed, 272 insertions(+), 4 deletions(-) create mode 100644 injected/docs/theme-color.md create mode 100644 injected/integration-test/test-pages/theme-color/config/theme-color-absent.json create mode 100644 injected/integration-test/test-pages/theme-color/config/theme-color-disabled.json create mode 100644 injected/integration-test/test-pages/theme-color/config/theme-color-enabled.json create mode 100644 injected/integration-test/test-pages/theme-color/index.html create mode 100644 injected/integration-test/test-pages/theme-color/media-queries.html create mode 100644 injected/integration-test/test-pages/theme-color/no-theme-color.html create mode 100644 injected/integration-test/theme-color.spec.js create mode 100644 injected/src/features/theme-color.js create mode 100644 injected/src/messages/theme-color/themeColorFound.notify.json create mode 100644 injected/src/types/theme-color.ts diff --git a/injected/docs/theme-color.md b/injected/docs/theme-color.md new file mode 100644 index 0000000000..711a298ec0 --- /dev/null +++ b/injected/docs/theme-color.md @@ -0,0 +1,30 @@ +--- +title: Theme Color Monitor +--- + +# Theme Color Monitor + +Reports the presence of the theme-color meta tag on page load. + +The theme-color meta tag is used by browsers to customize the UI color to match the website's branding. This feature reports the theme color value when it's found on initial page load. + +## Notifications + +### `themeColorFound` +- {@link "Theme Color Messages".ThemeColorFoundNotification} +- Sends initial theme color value on page load +- If no theme-color meta tag is found, the themeColor value will be null + +**Example** + +```json +{ + "themeColor": "#ff0000", + "documentUrl": "https://example.com" +} +``` + +## Remote Config + +### Enabled (default) +{@includeCode ../integration-test/test-pages/theme-color/config/theme-color-enabled.json} diff --git a/injected/integration-test/test-pages/theme-color/config/theme-color-absent.json b/injected/integration-test/test-pages/theme-color/config/theme-color-absent.json new file mode 100644 index 0000000000..fdd2c29b7e --- /dev/null +++ b/injected/integration-test/test-pages/theme-color/config/theme-color-absent.json @@ -0,0 +1,6 @@ +{ + "features": { + + }, + "unprotectedTemporary": [] +} diff --git a/injected/integration-test/test-pages/theme-color/config/theme-color-disabled.json b/injected/integration-test/test-pages/theme-color/config/theme-color-disabled.json new file mode 100644 index 0000000000..797bffdf1f --- /dev/null +++ b/injected/integration-test/test-pages/theme-color/config/theme-color-disabled.json @@ -0,0 +1,9 @@ +{ + "features": { + "themeColor": { + "state": "disabled", + "exceptions": [] + } + }, + "unprotectedTemporary": [] +} diff --git a/injected/integration-test/test-pages/theme-color/config/theme-color-enabled.json b/injected/integration-test/test-pages/theme-color/config/theme-color-enabled.json new file mode 100644 index 0000000000..5f153296ac --- /dev/null +++ b/injected/integration-test/test-pages/theme-color/config/theme-color-enabled.json @@ -0,0 +1,9 @@ +{ + "features": { + "themeColor": { + "state": "enabled", + "exceptions": [] + } + }, + "unprotectedTemporary": [] +} diff --git a/injected/integration-test/test-pages/theme-color/index.html b/injected/integration-test/test-pages/theme-color/index.html new file mode 100644 index 0000000000..73b387b874 --- /dev/null +++ b/injected/integration-test/test-pages/theme-color/index.html @@ -0,0 +1,11 @@ + + + + + + Theme Color Test + + + + + diff --git a/injected/integration-test/test-pages/theme-color/media-queries.html b/injected/integration-test/test-pages/theme-color/media-queries.html new file mode 100644 index 0000000000..8f552eca24 --- /dev/null +++ b/injected/integration-test/test-pages/theme-color/media-queries.html @@ -0,0 +1,13 @@ + + + + + + Theme Color Media Queries Test + + + + + + + diff --git a/injected/integration-test/test-pages/theme-color/no-theme-color.html b/injected/integration-test/test-pages/theme-color/no-theme-color.html new file mode 100644 index 0000000000..58b56391d8 --- /dev/null +++ b/injected/integration-test/test-pages/theme-color/no-theme-color.html @@ -0,0 +1,10 @@ + + + + + + No Theme Color Test + + + + diff --git a/injected/integration-test/theme-color.spec.js b/injected/integration-test/theme-color.spec.js new file mode 100644 index 0000000000..bbbea63dfa --- /dev/null +++ b/injected/integration-test/theme-color.spec.js @@ -0,0 +1,77 @@ +import { test, expect } from '@playwright/test'; +import { ResultsCollector } from './page-objects/results-collector.js'; + +const HTML = '/theme-color/index.html'; +const CONFIG = './integration-test/test-pages/theme-color/config/theme-color-enabled.json'; + +test('theme-color feature absent', async ({ page }, testInfo) => { + const CONFIG = './integration-test/test-pages/theme-color/config/theme-color-absent.json'; + const themeColor = ResultsCollector.create(page, testInfo.project.use); + await themeColor.load(HTML, CONFIG); + + const messages = await themeColor.waitForMessage('themeColorFound', 1); + + expect(messages[0].payload.params).toStrictEqual({ + themeColor: '#ff0000', + documentUrl: 'http://localhost:3220/theme-color/index.html', + }); +}); + +test('theme-color (no theme color)', async ({ page }, testInfo) => { + const HTML = '/theme-color/no-theme-color.html'; + const themeColor = ResultsCollector.create(page, testInfo.project.use); + await themeColor.load(HTML, CONFIG); + + const messages = await themeColor.waitForMessage('themeColorFound', 1); + + expect(messages[0].payload.params).toStrictEqual({ + themeColor: null, + documentUrl: 'http://localhost:3220/theme-color/no-theme-color.html', + }); +}); + +test('theme-color (viewport media query)', async ({ page }, testInfo) => { + // Use a desktop viewport + await page.setViewportSize({ width: 1280, height: 720 }); + + const HTML = '/theme-color/media-queries.html'; + const themeColor = ResultsCollector.create(page, testInfo.project.use); + await themeColor.load(HTML, CONFIG); + + const messages = await themeColor.waitForMessage('themeColorFound', 1); + + expect(messages[0].payload.params).toStrictEqual({ + themeColor: '#00ff00', + documentUrl: 'http://localhost:3220/theme-color/media-queries.html', + }); +}); + +test('theme-color (color scheme media query)', async ({ page }, testInfo) => { + // Use a dark color scheme + await page.emulateMedia({ colorScheme: 'dark' }); + + const HTML = '/theme-color/media-queries.html'; + const themeColor = ResultsCollector.create(page, testInfo.project.use); + await themeColor.load(HTML, CONFIG); + + const messages = await themeColor.waitForMessage('themeColorFound', 1); + + expect(messages[0].payload.params).toStrictEqual({ + themeColor: '#0000ff', + documentUrl: 'http://localhost:3220/theme-color/media-queries.html', + }); +}); + +test('theme-color feature disabled completely', async ({ page }, testInfo) => { + const CONFIG = './integration-test/test-pages/theme-color/config/theme-color-disabled.json'; + const themeColor = ResultsCollector.create(page, testInfo.project.use); + await themeColor.load(HTML, CONFIG); + + // this is here purely to guard against a false positive in this test. + // without this manual `wait`, it might be possible for the following assertion to + // pass, but just because it was too quick (eg: the first message wasn't sent yet) + await page.waitForTimeout(100); + + const messages = await themeColor.outgoingMessages(); + expect(messages).toHaveLength(0); +}); diff --git a/injected/playwright.config.js b/injected/playwright.config.js index 6a7b86caeb..db548bc024 100644 --- a/injected/playwright.config.js +++ b/injected/playwright.config.js @@ -37,7 +37,11 @@ export default defineConfig({ }, { name: 'ios', - testMatch: ['integration-test/duckplayer-mobile.spec.js', 'integration-test/duckplayer-mobile-drawer.spec.js'], + testMatch: [ + 'integration-test/duckplayer-mobile.spec.js', + 'integration-test/duckplayer-mobile-drawer.spec.js', + 'integration-test/theme-color.spec.js', + ], use: { injectName: 'apple-isolated', platform: 'ios', ...devices['iPhone 13'] }, }, { @@ -47,6 +51,7 @@ export default defineConfig({ 'integration-test/duckplayer-mobile-drawer.spec.js', 'integration-test/web-compat-android.spec.js', 'integration-test/message-bridge-android.spec.js', + 'integration-test/theme-color.spec.js', ], use: { injectName: 'android', platform: 'android', ...devices['Galaxy S5'] }, }, diff --git a/injected/src/features.js b/injected/src/features.js index be1345e430..5523131155 100644 --- a/injected/src/features.js +++ b/injected/src/features.js @@ -27,14 +27,15 @@ const otherFeatures = /** @type {const} */ ([ 'breakageReporting', 'autofillPasswordImport', 'favicon', + 'themeColor', ]); /** @typedef {baseFeatures[number]|otherFeatures[number]} FeatureName */ /** @type {Record} */ export const platformSupport = { apple: ['webCompat', ...baseFeatures], - 'apple-isolated': ['duckPlayer', 'brokerProtection', 'performanceMetrics', 'clickToLoad', 'messageBridge', 'favicon'], - android: [...baseFeatures, 'webCompat', 'breakageReporting', 'duckPlayer', 'messageBridge'], + 'apple-isolated': ['duckPlayer', 'brokerProtection', 'performanceMetrics', 'clickToLoad', 'messageBridge', 'favicon', 'themeColor'], + android: [...baseFeatures, 'webCompat', 'breakageReporting', 'duckPlayer', 'messageBridge', 'themeColor'], 'android-broker-protection': ['brokerProtection'], 'android-autofill-password-import': ['autofillPasswordImport'], windows: ['cookie', ...baseFeatures, 'windowsPermissionUsage', 'duckPlayer', 'brokerProtection', 'breakageReporting'], diff --git a/injected/src/features/theme-color.js b/injected/src/features/theme-color.js new file mode 100644 index 0000000000..903e048bc7 --- /dev/null +++ b/injected/src/features/theme-color.js @@ -0,0 +1,44 @@ +import ContentFeature from '../content-feature.js'; +import { isBeingFramed } from '../utils.js'; + +export class ThemeColor extends ContentFeature { + init() { + /** + * This feature never operates in a frame + */ + if (isBeingFramed()) return; + + window.addEventListener('DOMContentLoaded', () => { + // send once, immediately + this.send(); + }); + } + + send() { + const themeColor = getThemeColor(); + this.notify('themeColorFound', { themeColor, documentUrl: document.URL }); + } +} + +export default ThemeColor; + +/** + * Gets current theme color considering media queries + * Follows browser behavior by returning the last matching meta tag in document order + * @returns {string|null} The theme color value or null if not found + */ +function getThemeColor() { + const metaTags = document.head.querySelectorAll('meta[name="theme-color"]'); + if (metaTags.length === 0) { + return null; + } + + let lastMatchingTag = null; + for (const meta of metaTags) { + const mediaAttr = meta.getAttribute('media'); + if (!mediaAttr || window.matchMedia(mediaAttr).matches) { + lastMatchingTag = meta; + } + } + return lastMatchingTag ? lastMatchingTag.getAttribute('content') : null; +} diff --git a/injected/src/messages/theme-color/themeColorFound.notify.json b/injected/src/messages/theme-color/themeColorFound.notify.json new file mode 100644 index 0000000000..e70eb94113 --- /dev/null +++ b/injected/src/messages/theme-color/themeColorFound.notify.json @@ -0,0 +1,16 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "title": "ThemeColorFound", + "required": ["themeColor", "documentUrl"], + "properties": { + "themeColor": { + "type": ["string", "null"], + "description": "The theme color value, or null if not present" + }, + "documentUrl": { + "type": "string", + "description": "The URL of the document" + } + } +} diff --git a/injected/src/types/theme-color.ts b/injected/src/types/theme-color.ts new file mode 100644 index 0000000000..5e15ce1119 --- /dev/null +++ b/injected/src/types/theme-color.ts @@ -0,0 +1,37 @@ +/** + * These types are auto-generated from schema files. + * scripts/build-types.mjs is responsible for type generation. + * **DO NOT** edit this file directly as your changes will be lost. + * + * @module ThemeColor Messages + */ + +/** + * Requests, Notifications and Subscriptions from the ThemeColor feature + */ +export interface ThemeColorMessages { + notifications: ThemeColorFoundNotification; +} +/** + * Generated from @see "../messages/theme-color/themeColorFound.notify.json" + */ +export interface ThemeColorFoundNotification { + method: "themeColorFound"; + params: ThemeColorFound; +} +export interface ThemeColorFound { + /** + * The theme color value, or null if not present + */ + themeColor: string | null; + /** + * The URL of the document + */ + documentUrl: string; +} + +declare module "../features/theme-color.js" { + export interface ThemeColor { + notify: import("@duckduckgo/messaging/lib/shared-types").MessagingBase['notify'] + } +} \ No newline at end of file diff --git a/injected/src/utils.js b/injected/src/utils.js index 2a5691b88d..3777d58c3a 100644 --- a/injected/src/utils.js +++ b/injected/src/utils.js @@ -703,7 +703,7 @@ export function isGloballyDisabled(args) { * @import {FeatureName} from "./features"; * @type {FeatureName[]} */ -export const platformSpecificFeatures = ['windowsPermissionUsage', 'messageBridge', 'favicon']; +export const platformSpecificFeatures = ['windowsPermissionUsage', 'messageBridge', 'favicon', 'themeColor']; export function isPlatformSpecificFeature(featureName) { return platformSpecificFeatures.includes(featureName); From 09b0a03e666dd147b85652f49953b355b9920974 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 3 Apr 2025 16:19:34 +1100 Subject: [PATCH 2/4] Fix tests, remove android support for now --- .../test-pages/favicon/config/favicon-absent.json | 5 ++++- .../test-pages/favicon/config/favicon-disabled.json | 4 ++++ .../test-pages/favicon/config/favicon-enabled.json | 4 ++++ .../test-pages/favicon/config/favicon-monitor-disabled.json | 4 ++++ .../message-bridge/config/message-bridge-disabled.json | 4 ++++ .../message-bridge/config/message-bridge-enabled.json | 4 ++++ injected/playwright.config.js | 1 - injected/src/features.js | 2 +- 8 files changed, 25 insertions(+), 3 deletions(-) diff --git a/injected/integration-test/test-pages/favicon/config/favicon-absent.json b/injected/integration-test/test-pages/favicon/config/favicon-absent.json index fdd2c29b7e..797bffdf1f 100644 --- a/injected/integration-test/test-pages/favicon/config/favicon-absent.json +++ b/injected/integration-test/test-pages/favicon/config/favicon-absent.json @@ -1,6 +1,9 @@ { "features": { - + "themeColor": { + "state": "disabled", + "exceptions": [] + } }, "unprotectedTemporary": [] } diff --git a/injected/integration-test/test-pages/favicon/config/favicon-disabled.json b/injected/integration-test/test-pages/favicon/config/favicon-disabled.json index 842c4b57fe..b5d235ea9c 100644 --- a/injected/integration-test/test-pages/favicon/config/favicon-disabled.json +++ b/injected/integration-test/test-pages/favicon/config/favicon-disabled.json @@ -3,6 +3,10 @@ "favicon": { "state": "disabled", "exceptions": [] + }, + "themeColor": { + "state": "disabled", + "exceptions": [] } }, "unprotectedTemporary": [] diff --git a/injected/integration-test/test-pages/favicon/config/favicon-enabled.json b/injected/integration-test/test-pages/favicon/config/favicon-enabled.json index cd38719ed0..fe0749a2bb 100644 --- a/injected/integration-test/test-pages/favicon/config/favicon-enabled.json +++ b/injected/integration-test/test-pages/favicon/config/favicon-enabled.json @@ -6,6 +6,10 @@ "settings": { "monitor": true } + }, + "themeColor": { + "state": "disabled", + "exceptions": [] } }, "unprotectedTemporary": [] diff --git a/injected/integration-test/test-pages/favicon/config/favicon-monitor-disabled.json b/injected/integration-test/test-pages/favicon/config/favicon-monitor-disabled.json index 9afedd51bc..4fa41eeadc 100644 --- a/injected/integration-test/test-pages/favicon/config/favicon-monitor-disabled.json +++ b/injected/integration-test/test-pages/favicon/config/favicon-monitor-disabled.json @@ -6,6 +6,10 @@ "settings": { "monitor": false } + }, + "themeColor": { + "state": "disabled", + "exceptions": [] } }, "unprotectedTemporary": [] diff --git a/injected/integration-test/test-pages/message-bridge/config/message-bridge-disabled.json b/injected/integration-test/test-pages/message-bridge/config/message-bridge-disabled.json index 86ce1d86af..9571242daa 100644 --- a/injected/integration-test/test-pages/message-bridge/config/message-bridge-disabled.json +++ b/injected/integration-test/test-pages/message-bridge/config/message-bridge-disabled.json @@ -5,6 +5,10 @@ "state": "disabled", "exceptions": [] }, + "themeColor": { + "state": "disabled", + "exceptions": [] + }, "navigatorInterface": { "state": "enabled", "exceptions": [] diff --git a/injected/integration-test/test-pages/message-bridge/config/message-bridge-enabled.json b/injected/integration-test/test-pages/message-bridge/config/message-bridge-enabled.json index 32831bd678..2cac7bdcef 100644 --- a/injected/integration-test/test-pages/message-bridge/config/message-bridge-enabled.json +++ b/injected/integration-test/test-pages/message-bridge/config/message-bridge-enabled.json @@ -9,6 +9,10 @@ "state": "disabled", "exceptions": [] }, + "themeColor": { + "state": "disabled", + "exceptions": [] + }, "messageBridge": { "exceptions": [], "state": "enabled", diff --git a/injected/playwright.config.js b/injected/playwright.config.js index db548bc024..5d6ca7f87c 100644 --- a/injected/playwright.config.js +++ b/injected/playwright.config.js @@ -51,7 +51,6 @@ export default defineConfig({ 'integration-test/duckplayer-mobile-drawer.spec.js', 'integration-test/web-compat-android.spec.js', 'integration-test/message-bridge-android.spec.js', - 'integration-test/theme-color.spec.js', ], use: { injectName: 'android', platform: 'android', ...devices['Galaxy S5'] }, }, diff --git a/injected/src/features.js b/injected/src/features.js index 5523131155..e9a4534db4 100644 --- a/injected/src/features.js +++ b/injected/src/features.js @@ -35,7 +35,7 @@ const otherFeatures = /** @type {const} */ ([ export const platformSupport = { apple: ['webCompat', ...baseFeatures], 'apple-isolated': ['duckPlayer', 'brokerProtection', 'performanceMetrics', 'clickToLoad', 'messageBridge', 'favicon', 'themeColor'], - android: [...baseFeatures, 'webCompat', 'breakageReporting', 'duckPlayer', 'messageBridge', 'themeColor'], + android: [...baseFeatures, 'webCompat', 'breakageReporting', 'duckPlayer', 'messageBridge'], 'android-broker-protection': ['brokerProtection'], 'android-autofill-password-import': ['autofillPasswordImport'], windows: ['cookie', ...baseFeatures, 'windowsPermissionUsage', 'duckPlayer', 'brokerProtection', 'breakageReporting'], From 34647ba7bfda77992080f8fb9bea61544321ebc9 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 3 Apr 2025 16:29:12 +1100 Subject: [PATCH 3/4] Rename themeColorFound to themeColorStatus --- injected/docs/theme-color.md | 4 ++-- injected/integration-test/theme-color.spec.js | 8 ++++---- injected/src/features/theme-color.js | 2 +- ...ound.notify.json => themeColorStatus.notify.json} | 2 +- injected/src/types/theme-color.ts | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) rename injected/src/messages/theme-color/{themeColorFound.notify.json => themeColorStatus.notify.json} (92%) diff --git a/injected/docs/theme-color.md b/injected/docs/theme-color.md index 711a298ec0..724aa10443 100644 --- a/injected/docs/theme-color.md +++ b/injected/docs/theme-color.md @@ -10,8 +10,8 @@ The theme-color meta tag is used by browsers to customize the UI color to match ## Notifications -### `themeColorFound` -- {@link "Theme Color Messages".ThemeColorFoundNotification} +### `themeColorStatus` +- {@link "Theme Color Messages".ThemeColorStatusNotification} - Sends initial theme color value on page load - If no theme-color meta tag is found, the themeColor value will be null diff --git a/injected/integration-test/theme-color.spec.js b/injected/integration-test/theme-color.spec.js index bbbea63dfa..7ab32fb76b 100644 --- a/injected/integration-test/theme-color.spec.js +++ b/injected/integration-test/theme-color.spec.js @@ -9,7 +9,7 @@ test('theme-color feature absent', async ({ page }, testInfo) => { const themeColor = ResultsCollector.create(page, testInfo.project.use); await themeColor.load(HTML, CONFIG); - const messages = await themeColor.waitForMessage('themeColorFound', 1); + const messages = await themeColor.waitForMessage('themeColorStatus', 1); expect(messages[0].payload.params).toStrictEqual({ themeColor: '#ff0000', @@ -22,7 +22,7 @@ test('theme-color (no theme color)', async ({ page }, testInfo) => { const themeColor = ResultsCollector.create(page, testInfo.project.use); await themeColor.load(HTML, CONFIG); - const messages = await themeColor.waitForMessage('themeColorFound', 1); + const messages = await themeColor.waitForMessage('themeColorStatus', 1); expect(messages[0].payload.params).toStrictEqual({ themeColor: null, @@ -38,7 +38,7 @@ test('theme-color (viewport media query)', async ({ page }, testInfo) => { const themeColor = ResultsCollector.create(page, testInfo.project.use); await themeColor.load(HTML, CONFIG); - const messages = await themeColor.waitForMessage('themeColorFound', 1); + const messages = await themeColor.waitForMessage('themeColorStatus', 1); expect(messages[0].payload.params).toStrictEqual({ themeColor: '#00ff00', @@ -54,7 +54,7 @@ test('theme-color (color scheme media query)', async ({ page }, testInfo) => { const themeColor = ResultsCollector.create(page, testInfo.project.use); await themeColor.load(HTML, CONFIG); - const messages = await themeColor.waitForMessage('themeColorFound', 1); + const messages = await themeColor.waitForMessage('themeColorStatus', 1); expect(messages[0].payload.params).toStrictEqual({ themeColor: '#0000ff', diff --git a/injected/src/features/theme-color.js b/injected/src/features/theme-color.js index 903e048bc7..58e6f51c9c 100644 --- a/injected/src/features/theme-color.js +++ b/injected/src/features/theme-color.js @@ -16,7 +16,7 @@ export class ThemeColor extends ContentFeature { send() { const themeColor = getThemeColor(); - this.notify('themeColorFound', { themeColor, documentUrl: document.URL }); + this.notify('themeColorStatus', { themeColor, documentUrl: document.URL }); } } diff --git a/injected/src/messages/theme-color/themeColorFound.notify.json b/injected/src/messages/theme-color/themeColorStatus.notify.json similarity index 92% rename from injected/src/messages/theme-color/themeColorFound.notify.json rename to injected/src/messages/theme-color/themeColorStatus.notify.json index e70eb94113..6ca56bcf91 100644 --- a/injected/src/messages/theme-color/themeColorFound.notify.json +++ b/injected/src/messages/theme-color/themeColorStatus.notify.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "title": "ThemeColorFound", + "title": "themeColorStatus", "required": ["themeColor", "documentUrl"], "properties": { "themeColor": { diff --git a/injected/src/types/theme-color.ts b/injected/src/types/theme-color.ts index 5e15ce1119..1a3de7378b 100644 --- a/injected/src/types/theme-color.ts +++ b/injected/src/types/theme-color.ts @@ -10,16 +10,16 @@ * Requests, Notifications and Subscriptions from the ThemeColor feature */ export interface ThemeColorMessages { - notifications: ThemeColorFoundNotification; + notifications: ThemeColorStatusNotification; } /** - * Generated from @see "../messages/theme-color/themeColorFound.notify.json" + * Generated from @see "../messages/theme-color/themeColorStatus.notify.json" */ -export interface ThemeColorFoundNotification { - method: "themeColorFound"; - params: ThemeColorFound; +export interface ThemeColorStatusNotification { + method: "themeColorStatus"; + params: ThemeColorStatus; } -export interface ThemeColorFound { +export interface ThemeColorStatus { /** * The theme color value, or null if not present */ From 80230f1f947e3397bebbc99364e0414448263027 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Thu, 3 Apr 2025 19:06:19 +1100 Subject: [PATCH 4/4] Fix docs link --- injected/docs/theme-color.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/injected/docs/theme-color.md b/injected/docs/theme-color.md index 724aa10443..9ea8a2c934 100644 --- a/injected/docs/theme-color.md +++ b/injected/docs/theme-color.md @@ -11,7 +11,7 @@ The theme-color meta tag is used by browsers to customize the UI color to match ## Notifications ### `themeColorStatus` -- {@link "Theme Color Messages".ThemeColorStatusNotification} +- {@link "ThemeColor Messages".ThemeColorStatusNotification} - Sends initial theme color value on page load - If no theme-color meta tag is found, the themeColor value will be null