@@ -6,7 +6,7 @@ import type {
66 MarkdownStyle ,
77} from "react-native-enriched-markdown" ;
88import type { ComposerContextRecord } from "@t3tools/contracts" ;
9- import { contextChipColors , contextChipPresentation } from "../lib/composerChipPresentation" ;
9+ import { contextChipForeground , contextChipPresentation } from "../lib/composerChipPresentation" ;
1010import { CONTEXT_CHIP_ICON_SOURCES } from "../lib/contextChipIcons.generated" ;
1111import { FONT_FAMILIES } from "../lib/fontFamilies" ;
1212import { markdownFileIconSource } from "../lib/markdownFileIcons" ;
@@ -89,17 +89,14 @@ export function useEnrichedLinkVariants(
8989 }
9090 return byUrl ;
9191 } , [ assets , linkCustomization , skills , textStyle ] ) ;
92- const chips = useMemo (
92+ const chipForegrounds = useMemo (
9393 ( ) =>
9494 new Map (
9595 [ ...links ] . map ( ( [ url , link ] ) => [
9696 url ,
9797 link . chip
98- ? contextChipColors ( link . chip . accent ?? textStyle . color , {
99- foreground : textStyle . color ,
100- border : textStyle . contextChipBorderColor ?? textStyle . dividerColor ,
101- } )
102- : null ,
98+ ? contextChipForeground ( link . chip . accent ?? textStyle . color , textStyle . color )
99+ : undefined ,
103100 ] ) ,
104101 ) ,
105102 [ links , textStyle ] ,
@@ -108,27 +105,26 @@ export function useEnrichedLinkVariants(
108105 ( ) =>
109106 Object . fromEntries (
110107 [ ...links ] . map ( ( [ url , link ] ) => {
111- const colors = chips . get ( url ) ;
112- const composerChipEm = textStyle . fontSize * 0.86 * 0.5 ;
108+ const chipForeground = chipForegrounds . get ( url ) ;
113109 return [
114110 enrichedLinkVariantPattern ( url ) ,
115111 {
116112 pill : {
117- borderColor : colors ?. border ?? "transparent" ,
118- borderWidth : colors ? 1 : 0 ,
119- borderRadius : colors ? composerChipEm : 6 ,
120- paddingHorizontal : colors ? composerChipEm : 5 ,
121- paddingVertical : colors ? 0 : 2 ,
113+ borderColor : "transparent" ,
114+ borderWidth : 0 ,
115+ borderRadius : 6 ,
116+ paddingHorizontal : 5 ,
117+ paddingVertical : 2 ,
122118 } ,
123- fontFamily : colors ? FONT_FAMILIES . medium : textStyle . fontFamily ,
124- color : colors ?. foreground ?? link . color ?? textStyle . fileTextColor ,
119+ fontFamily : chipForeground ? FONT_FAMILIES . medium : textStyle . fontFamily ,
120+ color : chipForeground ?? link . color ?? textStyle . fileTextColor ,
125121 underline : false ,
126- backgroundColor : colors ?. background ?? "transparent" ,
122+ backgroundColor : "transparent" ,
127123 } ,
128124 ] ;
129125 } ) ,
130126 ) ,
131- [ chips , links , textStyle ] ,
127+ [ chipForegrounds , links , textStyle ] ,
132128 ) ;
133129 const linkPillContent = useMemo < Record < string , LinkPillContent > > (
134130 ( ) =>
@@ -138,11 +134,11 @@ export function useEnrichedLinkVariants(
138134 {
139135 label : link . label ,
140136 iconUri : link . icon ? Image . resolveAssetSource ( link . icon ) ?. uri : undefined ,
141- iconTintColor : link . chip ?. tintsIcon ? chips . get ( url ) ?. foreground : link . iconTintColor ,
137+ iconTintColor : link . chip ?. tintsIcon ? chipForegrounds . get ( url ) : link . iconTintColor ,
142138 } ,
143139 ] ) ,
144140 ) ,
145- [ chips , links ] ,
141+ [ chipForegrounds , links ] ,
146142 ) ;
147143 return { linkVariants, linkPillContent } ;
148144}
0 commit comments