From 56f9bd3f5e403f46289f8d70f6b7016c70086faa Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Thu, 9 Apr 2026 15:53:54 -0400 Subject: [PATCH] add colors and lexicon for embed ctx --- .../[publication]/[rkey]/PostContent.tsx | 16 +++++++++++++++- components/Blocks/EmbedBlock.tsx | 18 ++++++++++++++++-- components/Pages/IframePageView.tsx | 18 ++++++++++++++++-- lexicons/api/index.ts | 2 ++ lexicons/api/lexicons.ts | 17 +++++++++++++++++ lexicons/api/types/parts/page/embed/ctx.ts | 19 +++++++++++++++++++ lexicons/parts/page/embed/ctx.json | 19 +++++++++++++++++++ lexicons/src/mentionService.ts | 15 +++++++++++++++ 8 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 lexicons/api/types/parts/page/embed/ctx.ts create mode 100644 lexicons/parts/page/embed/ctx.json diff --git a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx index 12f234d8..21841e6d 100644 --- a/app/lish/[did]/[publication]/[rkey]/PostContent.tsx +++ b/app/lish/[did]/[publication]/[rkey]/PostContent.tsx @@ -37,6 +37,9 @@ import { blockTextSize } from "src/utils/blockTextSize"; import { slugify } from "src/utils/slugify"; import { PostNotAvailable } from "components/Blocks/BlueskyPostBlock/BlueskyEmbed"; import { useIframeChannel } from "src/hooks/useIframeChannel"; +import { usePubTheme } from "components/ThemeManager/PublicationThemeProvider"; +import { colorToString } from "components/ThemeManager/useColorAttribute"; +import { useDocument } from "contexts/DocumentContext"; import { openPage as openPageAction } from "./postPageState"; export function PostContent({ @@ -457,8 +460,19 @@ function PublishedIframeBlock(props: { onAddBelow: () => {}, }); + let { theme } = useDocument(); + let pubTheme = usePubTheme(theme); let iframeSrc = new URL(props.url); - iframeSrc.searchParams.set("parts.page.mode", "view"); + iframeSrc.searchParams.set("parts.page.embed.ctx.mode", "view"); + iframeSrc.searchParams.set( + "parts.page.embed.ctx.bgColor", + `rgb(${colorToString(pubTheme.bgPage, "rgb")})`, + ); + iframeSrc.searchParams.set( + "parts.page.embed.ctx.primaryColor", + `rgb(${colorToString(pubTheme.primary, "rgb")})`, + ); + return (