Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(chat): solid selection toolbar and explicit search-hit text color in both themes (#22119)

Lobehub Codercb24b08c315f
diff --git a/src/features/Conversation/Messages/components/TextSelectionActionLayer/index.tsx b/src/features/Conversation/Messages/components/TextSelectionActionLayer/index.tsx
index be2bee68093..740e91f6c6f 100644
--- a/src/features/Conversation/Messages/components/TextSelectionActionLayer/index.tsx
+++ b/src/features/Conversation/Messages/components/TextSelectionActionLayer/index.tsx
@@ -2,6 +2,7 @@
import { nanoid } from '@lobechat/utils';
import { Button, Flexbox, toast } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
import { MessageCirclePlusIcon } from 'lucide-react';
import type { CSSProperties, PointerEvent, ReactNode } from 'react';
@@ -42,9 +43,12 @@ const styles = stylex.create({
padding: '4px',
borderWidth: '1px',
borderStyle: 'solid',
- borderColor: 'light-dark(rgb(229 231 235), rgb(64 64 64))',
+ // Theme tokens, not the CSS light-dark function: the build rewrites it into
+ // `--lightningcss-*` fallbacks that never resolve here, which left the border
+ // two-toned and the background transparent.
+ borderColor: cssVar.colorBorder,
borderRadius: '999px',
- backgroundColor: 'light-dark(#fff, #1f1f1f)',
+ backgroundColor: cssVar.colorBgElevated,
backgroundImage: 'none',
boxShadow: '0 8px 24px rgb(0 0 0 / 12%), 0 2px 8px rgb(0 0 0 / 8%)',
},
diff --git a/src/features/Conversation/WorkingSidebar/Search/index.tsx b/src/features/Conversation/WorkingSidebar/Search/index.tsx
index 1f129ec491e..af9ae4e026f 100644
--- a/src/features/Conversation/WorkingSidebar/Search/index.tsx
+++ b/src/features/Conversation/WorkingSidebar/Search/index.tsx
@@ -33,10 +33,12 @@ import { useTopicSearch } from './useTopicSearch';
const SEARCH_DEBOUNCE_MS = 250;
// `::highlight()` is a document-level pseudo-element, so it cannot be a scoped
-// StyleX rule. React hoists and dedupes this sheet by its `href`.
+// StyleX rule. React hoists and dedupes this sheet by its `href`. It sets the
+// text color with the fill so matches stay readable whatever color the message
+// text has.
const HIGHLIGHT_SHEET = `
-::highlight(${TOPIC_SEARCH_HIGHLIGHT.all}) { background-color: ${lobeCssVar.colorWarningBgHover}; }
-::highlight(${TOPIC_SEARCH_HIGHLIGHT.active}) { background-color: ${lobeCssVar.colorWarningBorder}; }
+::highlight(${TOPIC_SEARCH_HIGHLIGHT.all}) { background-color: ${lobeCssVar.colorWarningBgHover}; color: ${lobeCssVar.colorText}; }
+::highlight(${TOPIC_SEARCH_HIGHLIGHT.active}) { background-color: ${lobeCssVar.colorWarningBorder}; color: ${lobeCssVar.colorText}; }
`;
const styles = stylex.create({
@@ -73,7 +75,7 @@ const styles = stylex.create({
mark: {
backgroundColor: cssVar.colorWarningBgHover,
borderRadius: 2,
- color: 'inherit',
+ color: cssVar.colorText,
},
meta: {
color: cssVar.colorTextTertiary,