fix(rn-baseline): sync with uikit color and update list

Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
Innei
2025-01-13 20:13:17 +08:00
parent 6828606cc4
commit 91f5340407
20 changed files with 183 additions and 116 deletions
@@ -1,5 +1,8 @@
import { Animated, FlatList, ScrollView, TouchableOpacity } from "react-native"
import { Animated, FlatList, Pressable, ScrollView, TouchableOpacity } from "react-native"
import Reanimated from "react-native-reanimated"
export const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView)
export const AnimatedFlatList = Animated.createAnimatedComponent(FlatList)
export const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity)
export const ReAnimatedPressable = Reanimated.createAnimatedComponent(Pressable)
@@ -6,7 +6,7 @@ import ContextMenu from "react-native-context-menu-view"
import { useEventCallback } from "usehooks-ts"
import { MingcuteDownLineIcon } from "@/src/icons/mingcute_down_line"
import { useColor } from "@/src/theme/colors"
import { accentColor } from "@/src/theme/colors"
import { FormLabel } from "./Label"
@@ -52,11 +52,9 @@ export function Select<T>({
onValueChange(currentValue)
}, [])
const systemFill = useColor("text")
return (
<View className="w-full flex-1 flex-row items-center">
{!!label && <FormLabel className="pl-1" label={label} />}
{!!label && <FormLabel className="pl-2" label={label} />}
<View className="flex-1" />
{/* Trigger */}
<ContextMenu
@@ -72,15 +70,15 @@ export function Select<T>({
>
<View
className={cn(
"border-system-fill/80 bg-system-fill/30 h-8 flex-row items-center rounded-lg border pl-3 pr-2",
"h-8 flex-row items-center rounded-lg pl-3 pr-2",
"min-w-[80px]",
wrapperClassName,
)}
style={wrapperStyle}
>
<Text className="text-text">{valueToLabelMap.get(currentValue)}</Text>
<View className="ml-auto shrink-0 pl-2">
<MingcuteDownLineIcon color={systemFill} height={16} width={16} />
<Text className="font-semibold text-accent">{valueToLabelMap.get(currentValue)}</Text>
<View className="ml-auto shrink-0 pl-1">
<MingcuteDownLineIcon color={accentColor} height={18} width={18} />
</View>
</View>
</ContextMenu>
@@ -21,7 +21,7 @@ export const FormSwitch = forwardRef<Switch, Props & SwitchProps>(
<View className="flex-1">
{!!label && <FormLabel className="pl-1" label={label} optional />}
{!!description && (
<Text className="text-secondary-text mb-1 pl-1 text-sm">{description}</Text>
<Text className="text-secondary-label mb-1 pl-1 text-sm">{description}</Text>
)}
</View>
<Switch trackColor={{ true: accentColor }} ref={ref} {...rest} />
@@ -23,15 +23,13 @@ export const TextField = forwardRef<TextInput, TextInputProps & TextFieldProps>(
) => {
return (
<>
{!!label && <FormLabel className="pl-1" label={label} optional={!required} />}
{!!label && <FormLabel className="pl-2" label={label} optional={!required} />}
{!!description && (
<Text className="text-system-secondary-label text-secondary-text mb-1 pl-1 text-sm">
{description}
</Text>
<Text className="text-secondary-label mb-1 pl-1 text-sm">{description}</Text>
)}
<View
className={cn(
"bg-system-fill/40 relative h-10 flex-row items-center rounded-lg px-4",
"bg-tertiary-system-fill relative h-10 flex-row items-center rounded-lg px-3",
wrapperClassName,
)}
style={wrapperStyle}
@@ -39,7 +37,7 @@ export const TextField = forwardRef<TextInput, TextInputProps & TextFieldProps>(
<TextInput
selectionColor={accentColor}
ref={ref}
className={cn("text-text placeholder:text-placeholder-text w-full flex-1", className)}
className={cn("text-text placeholder:text-secondary-label w-full flex-1", className)}
style={StyleSheet.flatten([styles.textField, style])}
{...rest}
/>
@@ -1,22 +1,61 @@
import { cn, composeEventHandlers } from "@follow/utils"
import { memo, useState } from "react"
import { Pressable } from "react-native"
import { memo, useEffect, useState } from "react"
import type { Pressable } from "react-native"
import { StyleSheet } from "react-native"
import {
Easing,
interpolateColor,
useAnimatedStyle,
useSharedValue,
withTiming,
} from "react-native-reanimated"
import { useColor } from "@/src/theme/colors"
import { ReAnimatedPressable } from "../../common/AnimatedComponents"
export const ItemPressable: typeof Pressable = memo(({ children, ...props }) => {
const [isPressing, setIsPressing] = useState(false)
const secondarySystemGroupedBackground = useColor("secondarySystemGroupedBackground")
const systemFill = useColor("systemFill")
const pressed = useSharedValue(0)
useEffect(() => {
if (isPressing) {
pressed.value = 1
} else {
pressed.value = withTiming(0, {
duration: 300,
easing: Easing.ease,
})
}
}, [isPressing, pressed])
const colorStyle = useAnimatedStyle(() => {
return {
backgroundColor: interpolateColor(
pressed.value,
[0, 1],
[secondarySystemGroupedBackground, systemFill],
),
}
})
return (
<Pressable
<ReAnimatedPressable
{...props}
onPressIn={composeEventHandlers(props.onPressIn, () => setIsPressing(true))}
onPressOut={composeEventHandlers(props.onPressOut, () => setIsPressing(false))}
onHoverIn={composeEventHandlers(props.onHoverIn, () => setIsPressing(true))}
onHoverOut={composeEventHandlers(props.onHoverOut, () => setIsPressing(false))}
className={cn(
isPressing ? "bg-tertiary-system-background" : "bg-system-background",
// isPressing ? "bg-system-fill" : "bg-secondary-system-grouped-background",
props.className,
)}
style={StyleSheet.flatten([colorStyle, props.style])}
>
{children}
</Pressable>
</ReAnimatedPressable>
)
})
@@ -176,7 +176,7 @@ const ItemRenderer = ({
if (typeof item === "string") {
// Rendering header
return (
<View className="border-b-separator border-b-hairline mx-6 mb-1 mt-2 pb-1">
<View className="border-b-opaque-separator border-b-hairline mx-6 mb-1 mt-2 pb-1">
<Text className="text-secondary-label text-base">{item}</Text>
</View>
)
@@ -256,7 +256,7 @@ const NavigationSidebar: FC<{
scrollToLetter(title)
}}
>
<Text className="text-secondary-text/60 text-sm">{title}</Text>
<Text className="text-tertiary-label text-sm">{title}</Text>
</TouchableOpacity>
))}
</View>
+8 -8
View File
@@ -66,11 +66,11 @@ const DiscoverHeaderImpl = () => {
}
const PlaceholerSearchBar = () => {
const placeholderTextColor = useColor("placeholderText")
const labelColor = useColor("secondaryLabel")
return (
<Pressable
style={styles.searchbar}
className="bg-gray-5/60"
className="bg-tertiary-system-fill"
onPress={() => {
router.push("/search")
}}
@@ -79,8 +79,8 @@ const PlaceholerSearchBar = () => {
className="absolute inset-0 flex flex-row items-center justify-center"
pointerEvents="none"
>
<Search2CuteReIcon color={placeholderTextColor} height={18} width={18} />
<Text className="text-placeholder-text ml-1" style={styles.searchPlaceholderText}>
<Search2CuteReIcon color={labelColor} height={18} width={18} />
<Text className="text-secondary-label ml-1" style={styles.searchPlaceholderText}>
Search
</Text>
</View>
@@ -116,7 +116,7 @@ const ComposeSearchBar = () => {
const SearchInput = () => {
const { searchFocusedAtom, searchValueAtom } = useSearchPageContext()
const [isFocused, setIsFocused] = useAtom(searchFocusedAtom)
const placeholderTextColor = useColor("placeholderText")
const placeholderTextColor = useColor("secondaryLabel")
const searchValue = useAtomValue(searchValueAtom)
const setSearchValue = useSetAtom(searchValueAtom)
const inputRef = useRef<TextInput>(null)
@@ -183,7 +183,7 @@ const SearchInput = () => {
}, [isFocused])
return (
<View style={styles.searchbar} className="bg-gray-5/60">
<View style={styles.searchbar} className="bg-tertiary-system-fill">
{focusOrHasValue && (
<Animated.View
style={{
@@ -193,7 +193,7 @@ const SearchInput = () => {
>
<Search2CuteReIcon color={placeholderTextColor} height={18} width={18} />
{!searchValue && !tempSearchValue && (
<Text className="text-placeholder-text ml-2" style={styles.searchPlaceholderText}>
<Text className="text-secondary-label ml-2" style={styles.searchPlaceholderText}>
Search
</Text>
)}
@@ -228,7 +228,7 @@ const SearchInput = () => {
pointerEvents="none"
>
<Search2CuteReIcon color={placeholderTextColor} height={18} width={18} />
<Text className="text-placeholder-text ml-1" style={styles.searchPlaceholderText}>
<Text className="text-secondary-label ml-1" style={styles.searchPlaceholderText}>
Search
</Text>
</Animated.View>
@@ -1,13 +1,15 @@
import { memo, useState } from "react"
import { Text, TouchableOpacity, View } from "react-native"
import { Text, TouchableOpacity } from "react-native"
import Animated, { useAnimatedStyle, useSharedValue, withSpring } from "react-native-reanimated"
import { ItemPressable } from "@/src/components/ui/pressable/item-pressable"
import { MingcuteRightLine } from "@/src/icons/mingcute_right_line"
import { useUnreadCounts } from "@/src/store/unread/hooks"
import { useColor } from "@/src/theme/colors"
import { SubscriptionFeedCategoryContextMenu } from "../context-menu/feeds"
import { GroupedContext, useViewPageCurrentView } from "./ctx"
import { ItemSeparator } from "./ItemSeparator"
import { UnGroupedList } from "./UnGroupedList"
// const CategoryList: FC<{
@@ -30,6 +32,7 @@ export const CategoryGrouped = memo(
}, [rotateSharedValue])
const view = useViewPageCurrentView()
const tertiaryLabelColor = useColor("tertiaryLabel")
return (
<>
<SubscriptionFeedCategoryContextMenu
@@ -41,7 +44,7 @@ export const CategoryGrouped = memo(
onPress={() => {
// TODO navigate to category
}}
className="border-item-pressed h-12 flex-row items-center border-b px-3"
className="h-12 flex-row items-center px-3"
>
<TouchableOpacity
hitSlop={10}
@@ -52,21 +55,20 @@ export const CategoryGrouped = memo(
className="size-5 flex-row items-center justify-center"
>
<Animated.View style={rotateStyle}>
<MingcuteRightLine color="gray" height={18} width={18} />
<MingcuteRightLine color={tertiaryLabelColor} height={18} width={18} />
</Animated.View>
</TouchableOpacity>
<Text className="text-text ml-3">{category}</Text>
{!!unreadCounts && (
<Text className="text-tertiary-label ml-auto text-xs">{unreadCounts}</Text>
<Text className="text-secondary-label ml-auto text-xs">{unreadCounts}</Text>
)}
</ItemPressable>
</SubscriptionFeedCategoryContextMenu>
{expanded && (
<GroupedContext.Provider value={category}>
<View>
<UnGroupedList subscriptionIds={subscriptionIds} />
</View>
<ItemSeparator />
<UnGroupedList subscriptionIds={subscriptionIds} />
</GroupedContext.Provider>
)}
</>
@@ -0,0 +1,8 @@
import { StyleSheet, View } from "react-native"
const el = (
<View className="bg-opaque-separator w-full" style={{ height: StyleSheet.hairlineWidth }} />
)
export const ItemSeparator = () => {
return el
}
@@ -3,7 +3,7 @@ import { useBottomTabBarHeight } from "@react-navigation/bottom-tabs"
import { useHeaderHeight } from "@react-navigation/elements"
import { useAtom } from "jotai"
import { memo, useEffect, useMemo, useRef, useState } from "react"
import { RefreshControl, StyleSheet, Text, View } from "react-native"
import { FlatList, RefreshControl, StyleSheet, Text, View } from "react-native"
import PagerView from "react-native-pager-view"
import ReAnimated, { LinearTransition } from "react-native-reanimated"
import { useSafeAreaInsets } from "react-native-safe-area-context"
@@ -29,6 +29,7 @@ import { useViewPageCurrentView, ViewPageCurrentViewProvider } from "./ctx"
import { InboxItem } from "./items/InboxItem"
import { ListSubscriptionItem } from "./items/ListSubscriptionItem"
import { SubscriptionItem } from "./items/SubscriptionItem"
import { ItemSeparator } from "./ItemSeparator"
export const SubscriptionLists = memo(() => {
const [currentView, setCurrentView] = useAtom(viewAtom)
@@ -112,6 +113,7 @@ const SubscriptionList = ({ view }: { view: FeedViewType }) => {
refreshing={refreshing}
/>
}
className={"bg-system-grouped-background"}
contentInsetAdjustmentBehavior="automatic"
scrollIndicatorInsets={{
bottom: tabHeight - insets.bottom,
@@ -121,6 +123,7 @@ const SubscriptionList = ({ view }: { view: FeedViewType }) => {
paddingTop: offsetTop,
paddingBottom: tabHeight,
}}
ItemSeparatorComponent={ItemSeparator}
data={data}
ListHeaderComponent={ListHeaderComponent}
renderItem={ItemRender}
@@ -165,7 +168,7 @@ const ListHeaderComponent = () => {
<StarItem />
{view === FeedViewType.Articles && <InboxList />}
<ListList />
<Text className="text-tertiary-label mb-2 ml-3 mt-4 text-sm font-medium">Feeds</Text>
<Text className="text-secondary-label mb-2 ml-3 mt-4 text-sm font-medium">Feeds</Text>
</>
)
}
@@ -175,13 +178,17 @@ const InboxList = () => {
if (inboxes.length === 0) return null
return (
<View>
<Text className="text-tertiary-label mb-2 ml-3 mt-4 text-sm font-medium">Inboxes</Text>
{inboxes.map((id) => {
return <InboxItem key={id} id={id} />
})}
<Text className="text-secondary-label mb-2 ml-3 mt-4 text-sm font-medium">Inboxes</Text>
<FlatList
data={inboxes}
renderItem={renderInboxItems}
ItemSeparatorComponent={ItemSeparator}
/>
</View>
)
}
const renderInboxItems = ({ item }: { item: string }) => <InboxItem id={item} />
const StarItem = () => {
return (
@@ -204,13 +211,19 @@ const ListList = () => {
if (sortedListIds.length === 0) return null
return (
<View className="mt-4">
<Text className="text-tertiary-label mb-2 ml-3 text-sm font-medium">Lists</Text>
{sortedListIds.map((id) => {
<Text className="text-secondary-label mb-2 ml-3 text-sm font-medium">Lists</Text>
{/* {sortedListIds.map((id) => {
return <ListSubscriptionItem key={id} id={id} />
})}
})} */}
<FlatList
data={sortedListIds}
renderItem={renderListItems}
ItemSeparatorComponent={ItemSeparator}
/>
</View>
)
}
const renderListItems = ({ item }: { item: string }) => <ListSubscriptionItem id={item} />
const style = StyleSheet.create({
flex: {
@@ -1,9 +1,11 @@
import type { FC } from "react"
import { FlatList } from "react-native"
import { useSortedUngroupedSubscription } from "@/src/store/subscription/hooks"
import { useFeedListSortMethod, useFeedListSortOrder } from "./atoms"
import { SubscriptionItem } from "./items/SubscriptionItem"
import { ItemSeparator } from "./ItemSeparator"
export const UnGroupedList: FC<{
subscriptionIds: string[]
@@ -11,15 +13,14 @@ export const UnGroupedList: FC<{
const sortBy = useFeedListSortMethod()
const sortOrder = useFeedListSortOrder()
const sortedSubscriptionIds = useSortedUngroupedSubscription(subscriptionIds, sortBy, sortOrder)
const lastSubscriptionId = sortedSubscriptionIds.at(-1)
return sortedSubscriptionIds.map((id) => {
return (
<SubscriptionItem
key={id}
id={id}
className={id === lastSubscriptionId ? "border-b-transparent" : ""}
/>
)
})
return (
<FlatList
data={sortedSubscriptionIds}
renderItem={renderSubscriptionItems}
ItemSeparatorComponent={ItemSeparator}
/>
)
}
const renderSubscriptionItems = ({ item }: { item: string }) => <SubscriptionItem id={item} />
@@ -66,7 +66,7 @@ export const ViewTab = () => {
return (
<ThemedBlurView
style={[styles.tabContainer, { height: headerHeight + ViewTabHeight }]}
className="border-system-fill/60 relative border-b"
className="border-opaque-separator border-b-hairline relative"
>
<View className="absolute inset-x-0 bottom-0" style={{ height: ViewTabHeight }}>
<ScrollView
@@ -74,7 +74,6 @@ export const ViewTab = () => {
scrollOffsetX.current = event.nativeEvent.contentOffset.x
}}
showsHorizontalScrollIndicator={false}
className="border-tertiary-system-background"
horizontal
ref={tabRef}
contentContainerStyle={styles.tabScroller}
@@ -16,7 +16,7 @@ export const InboxItem = memo(({ id }: { id: string }) => {
if (!subscription) return null
return (
<Animated.View exiting={FadeOutUp}>
<ItemPressable className="border-item-pressed h-12 flex-row items-center border-b px-3">
<ItemPressable className="h-12 flex-row items-center px-3">
<View className="ml-0.5 overflow-hidden rounded">
<InboxCuteFiIcon
height={20}
@@ -16,7 +16,7 @@ export const ListSubscriptionItem = memo(({ id }: { id: string; className?: stri
return (
<Animated.View exiting={FadeOutUp}>
<SubscriptionListItemContextMenu id={id}>
<ItemPressable className="border-item-pressed h-12 flex-row items-center border-b px-3">
<ItemPressable className="h-12 flex-row items-center px-3">
<View className="overflow-hidden rounded">
{!!list.image && (
<Image source={{ uri: list.image, width: 24, height: 24 }} resizeMode="cover" />
@@ -48,6 +48,7 @@ export const SubscriptionItem = memo(({ id, className }: { id: string; className
const feed = useFeed(id)
const inGrouped = !!useContext(GroupedContext)
const view = useViewPageCurrentView()
// const swipeableRef: SwipeableRef = useRef(null)
if (!subscription || !feed) return null
@@ -73,7 +74,7 @@ export const SubscriptionItem = memo(({ id, className }: { id: string; className
className={cn(
"flex h-12 flex-row items-center",
inGrouped ? "pl-8 pr-4" : "px-4",
"border-item-pressed border-b",
className,
)}
onPress={() => {
+3 -5
View File
@@ -116,21 +116,19 @@ function FollowImpl() {
/>
{/* Group 1 */}
<View className="bg-system-grouped-background-2 rounded-lg p-4">
<View className="bg-secondary-system-grouped-background rounded-lg p-4">
<View className="flex flex-row gap-4">
<View className="size-[50px] overflow-hidden rounded-lg">
<FeedIcon feed={feed} size={50} />
</View>
<View className="flex-1 flex-col gap-y-1">
<Text className="text-text text-lg font-semibold">{feed?.title}</Text>
<Text className="text-system-secondary-label text-secondary-text text-sm">
{feed?.description}
</Text>
<Text className="text-secondary-label text-sm">{feed?.description}</Text>
</View>
</View>
</View>
{/* Group 2 */}
<View className="bg-system-grouped-background-2 gap-y-4 rounded-lg p-4">
<View className="bg-secondary-system-grouped-background gap-y-4 rounded-lg p-4">
<FormProvider form={form}>
<View>
<Controller
@@ -121,7 +121,7 @@ function FormImpl({ route, routePrefix, name }: RsshubFormParams) {
<PortalProvider>
<KeyboardAwareScrollView className="bg-system-grouped-background">
<View className="bg-system-grouped-background-2 mx-2 gap-4 rounded-lg px-3 py-6">
<View className="bg-secondary-system-grouped-background mx-2 mt-4 gap-4 rounded-lg px-3 py-6">
{keys.map((keyItem) => {
const parameters = normalizeRSSHubParameters(route.parameters[keyItem.name])
@@ -172,7 +172,9 @@ function FormImpl({ route, routePrefix, name }: RsshubFormParams) {
)}
{!!parameters && (
<Text className="text-text/80 ml-1 mt-2 text-xs">{parameters.description}</Text>
<Text className="text-secondary-label ml-2 mt-1 text-xs">
{parameters.description}
</Text>
)}
</View>
)
@@ -200,11 +202,13 @@ const Maintainers = ({ maintainers }: { maintainers?: string[] }) => {
}
return (
<View className="text-text/80 mx-4 mt-2 flex flex-row flex-wrap gap-x-1 text-sm">
<Text className="text-text/80 text-xs">This feed is provided by RSSHub, with credit to </Text>
<View className="text-tertiary-label mx-4 mt-2 flex flex-row flex-wrap gap-x-1 text-sm">
<Text className="text-secondary-label text-xs">
This feed is provided by RSSHub, with credit to{" "}
</Text>
{maintainers.map((m) => (
<TouchableOpacity key={m} onPress={() => Linking.openURL(`https://github.com/${m}`)}>
<Text className="text-text/50 text-xs">@{m}</Text>
<Text className="text-xs text-accent/90">@{m}</Text>
</TouchableOpacity>
))}
</View>
+30 -29
View File
@@ -64,33 +64,34 @@ export const palette = {
export const lightVariants = {
// UIKit Colors
label: "0 0 0",
secondaryLabel: "122 122 122",
tertiaryLabel: "172 172 178",
quaternaryLabel: "199 199 204",
placeholderText: "199 199 204",
separator: "209 209 214",
opaqueSeparator: "229 229 234",
separator: "84 84 86 0.34",
opaqueSeparator: "84 84 86 0.34",
nonOpaqueSeparator: "198 198 200",
link: "0 122 255",
systemBackground: "255 255 255",
secondarySystemBackground: "242 242 247",
tertiarySystemBackground: "229 229 234",
tertiarySystemBackground: "255 255 255",
// Grouped
systemGroupedBackground: "242 242 247",
systemGroupedBackground2: "255 255 255",
secondarySystemGroupedBackground: "255 255 255",
tertiarySystemGroupedBackground: "242 242 247",
// System Colors
systemFill: "209 213 219",
secondarySystemFill: "209 213 219",
tertiarySystemFill: "209 213 219",
quaternarySystemFill: "209 213 219",
systemFill: "120 120 128 0.2",
secondarySystemFill: "120 120 128 0.16",
tertiarySystemFill: "120 120 128 0.12",
quaternarySystemFill: "120 120 128 0.08",
// Text Colors
label: "0 0 0",
text: "0 0 0",
secondaryText: "142 142 147",
tertiaryText: "99 99 102",
quaternaryText: "72 72 74",
secondaryLabel: "60 60 67 0.6",
tertiaryLabel: "60 60 67 0.3",
quaternaryLabel: "60 60 67 0.18",
// Extended colors
disabled: "235 235 228",
@@ -98,13 +99,11 @@ export const lightVariants = {
}
export const darkVariants = {
// UIKit Colors
label: "255 255 255",
secondaryLabel: "172 172 178",
tertiaryLabel: "122 122 122",
quaternaryLabel: "99 99 102",
placeholderText: "122 122 122",
separator: "72 72 74",
opaqueSeparator: "58 58 60",
separator: "56 56 58 0.6",
opaqueSeparator: "56 56 58 0.6",
nonOpaqueSeparator: "84 84 86",
link: "10 132 255",
systemBackground: "0 0 0",
secondarySystemBackground: "28 28 30",
@@ -112,19 +111,21 @@ export const darkVariants = {
// Grouped
systemGroupedBackground: "0 0 0",
systemGroupedBackground2: "28 28 30",
secondarySystemGroupedBackground: "28 28 30",
tertiarySystemGroupedBackground: "44 44 46",
// System Colors
systemFill: "72 72 74",
secondarySystemFill: "99 99 102",
tertiarySystemFill: "122 122 122",
quaternarySystemFill: "142 142 147",
systemFill: "120 120 128 36",
secondarySystemFill: "120 120 128 0.32",
tertiarySystemFill: "120 120 128 0.24",
quaternarySystemFill: "120 120 128 0.19",
// Text Colors
label: "255 255 255",
text: "255 255 255",
secondaryText: "172 172 178",
tertiaryText: "122 122 122",
quaternaryText: "99 99 102",
secondaryLabel: "235 235 245 0.6",
tertiaryLabel: "235 235 245 0.3",
quaternaryLabel: "235 235 245 0.18",
// Extended colors
disabled: "85 85 85",
+15 -13
View File
@@ -38,13 +38,11 @@ export default resolveConfig({
},
// System colors
label: "rgb(var(--color-label) / <alpha-value>)",
"secondary-label": "rgb(var(--color-secondaryLabel) / <alpha-value>)",
"tertiary-label": "rgb(var(--color-tertiaryLabel) / <alpha-value>)",
"quaternary-label": "rgb(var(--color-quaternaryLabel) / <alpha-value>)",
"placeholder-text": "rgb(var(--color-placeholderText) / <alpha-value>)",
separator: "rgb(var(--color-separator) / <alpha-value>)",
"opaque-separator": "rgb(var(--color-opaqueSeparator) / <alpha-value>)",
"opaque-separator": "rgba(var(--color-opaqueSeparator))",
"non-opaque-separator": "rgba(var(--color-nonOpaqueSeparator))",
link: "rgb(var(--color-link) / <alpha-value>)",
// Backgrounds
@@ -53,18 +51,22 @@ export default resolveConfig({
"rgb(var(--color-secondarySystemBackground) / <alpha-value>)",
"tertiary-system-background": "rgb(var(--color-tertiarySystemBackground) / <alpha-value>)",
"system-grouped-background": "rgb(var(--color-systemGroupedBackground) / <alpha-value>)",
"system-grouped-background-2": "rgb(var(--color-systemGroupedBackground2) / <alpha-value>)",
"secondary-system-grouped-background":
"rgb(var(--color-secondarySystemGroupedBackground) / <alpha-value>)",
"tertiary-system-grouped-background":
"rgb(var(--color-tertiarySystemGroupedBackground) / <alpha-value>)",
// System fills
"system-fill": "rgb(var(--color-systemFill) / <alpha-value>)",
"secondary-system-fill": "rgb(var(--color-secondarySystemFill) / <alpha-value>)",
"tertiary-system-fill": "rgb(var(--color-tertiarySystemFill) / <alpha-value>)",
"quaternary-system-fill": "rgb(var(--color-quaternarySystemFill) / <alpha-value>)",
"system-fill": "rgba(var(--color-systemFill))",
"secondary-system-fill": "rgba(var(--color-secondarySystemFill))",
"tertiary-system-fill": "rgba(var(--color-tertiarySystemFill))",
"quaternary-system-fill": "rgba(var(--color-quaternarySystemFill))",
// Text colors
label: "rgb(var(--color-text) / <alpha-value>)",
text: "rgb(var(--color-text) / <alpha-value>)",
"secondary-text": "rgb(var(--color-secondaryText) / <alpha-value>)",
"tertiary-text": "rgb(var(--color-tertiaryText) / <alpha-value>)",
"quaternary-text": "rgb(var(--color-quaternaryText) / <alpha-value>)",
"secondary-label": "rgba(var(--color-secondaryLabel))",
"tertiary-label": "rgba(var(--color-tertiaryLabel))",
"quaternary-label": "rgba(var(--color-quaternaryLabel))",
// Extended colors
disabled: "rgb(var(--color-disabled) / <alpha-value>)",
+2 -2
View File
@@ -162,6 +162,6 @@ export const withOpacity = (color: string, opacity: number) => {
}
}
export const rgbStringToRgb = (hex: string) => {
const [r, g, b] = hex.split(" ").map((s) => Number.parseInt(s))
return `rgb(${r}, ${g}, ${b})`
const [r, g, b, a] = hex.split(" ").map((s) => Number.parseFloat(s))
return `rgba(${r}, ${g}, ${b}, ${a || 1})`
}