diff --git a/src/components/Discover/TrendingTokens.tsx b/src/components/Discover/TrendingTokens.tsx index 489b90bbf83..de88bc4b52e 100644 --- a/src/components/Discover/TrendingTokens.tsx +++ b/src/components/Discover/TrendingTokens.tsx @@ -1,4 +1,4 @@ -import { DropdownMenu, MenuItem } from '@/components/DropdownMenu'; +import { DropdownMenu } from '@/components/DropdownMenu'; import { globalColors, Text, TextIcon, useBackgroundColor, useColorMode } from '@/design-system'; import { useForegroundColor } from '@/design-system/color/useForegroundColor'; @@ -19,7 +19,6 @@ import { swapsStore } from '@/state/swaps/swapsStore'; import { sortFilters, timeFilters, useTrendingTokensStore } from '@/state/trendingTokens/trendingTokens'; import { colors } from '@/styles'; import { darkModeThemeColors } from '@/styles/colors'; -import { useTheme } from '@/theme'; import { useCallback, useEffect, useMemo } from 'react'; import React, { Dimensions, FlatList, View } from 'react-native'; import LinearGradient from 'react-native-linear-gradient'; @@ -514,7 +513,6 @@ function NoResults() { function NetworkFilter() { const { isDarkMode } = useColorMode(); - const { colors } = useTheme(); const selected = useSharedValue(undefined); const chainId = useTrendingTokensStore(state => state.chainId); @@ -522,6 +520,8 @@ function NetworkFilter() { const { icon, label, lightenedNetworkColor } = useMemo(() => { if (!chainId) return { icon: '􀤆', label: i18n.t(t.all), lightenedNetworkColor: undefined }; + const lightenedNetworkColor = useBackendNetworksStore.getState().getColorsForChainId(chainId, isDarkMode); + return { icon: ( @@ -529,11 +529,11 @@ function NetworkFilter() { ), label: useBackendNetworksStore.getState().getChainsLabel()[chainId], - lightenedNetworkColor: colors.networkColors[chainId] - ? getMixedColor(colors.networkColors[chainId], globalColors.white100, isDarkMode ? 0.55 : 0.6) + lightenedNetworkColor: lightenedNetworkColor + ? getMixedColor(lightenedNetworkColor, globalColors.white100, isDarkMode ? 0.55 : 0.6) : undefined, }; - }, [chainId, colors.networkColors, isDarkMode]); + }, [chainId, isDarkMode]); const setSelected = useCallback( (chainId: ChainId | undefined) => { diff --git a/src/components/NetworkSwitcher.tsx b/src/components/NetworkSwitcher.tsx index 61394cdc5d4..2b385abb1fe 100644 --- a/src/components/NetworkSwitcher.tsx +++ b/src/components/NetworkSwitcher.tsx @@ -373,9 +373,10 @@ function AllNetworksSection({ } function NetworkOption({ chainId, selected }: { chainId: ChainId; selected: SharedValue }) { - const { colors } = useTheme(); + const { isDarkMode } = useColorMode(); + const getColorsForChainId = useBackendNetworksStore(state => state.getColorsForChainId); const chainName = useBackendNetworksStore.getState().getChainsLabel()[chainId]; - const chainColor = colors.networkColors[chainId] ? colors.networkColors[chainId] : undefined; + const chainColor = getColorsForChainId(chainId, isDarkMode); const isSelected = useDerivedValue(() => selected.value === chainId); const { animatedStyle } = useNetworkOptionStyle(isSelected, chainColor); diff --git a/src/screens/ExplainSheet.js b/src/screens/ExplainSheet.js index 9e30b06daa6..b63fa165f32 100644 --- a/src/screens/ExplainSheet.js +++ b/src/screens/ExplainSheet.js @@ -733,7 +733,7 @@ export const explainers = (params, theme) => { }, swap_refuel_add: { logo: ( - + { networkName: params?.networkName, gasToken: params?.gasToken, }), - textColor: colors?.networkColors[chainId], - bgColor: colors?.networkColors[chainId] && colors?.alpha(colors?.networkColors[chainId], 0.05), + textColor: color, + bgColor: color && colors?.alpha(color, 0.05), onPress: params?.onRefuel, }, }, swap_refuel_deduct: { logo: ( - + { networkName: params?.networkName, gasToken: params?.gasToken, }), - textColor: colors?.networkColors[chainId], - bgColor: colors?.networkColors[chainId] && colors?.alpha(colors?.networkColors[chainId], 0.05), + textColor: color, + bgColor: color && colors?.alpha(color, 0.05), onPress: params?.onRefuel, }, }, swap_refuel_notice: { extraHeight: 50, logo: ( - +