diff --git a/src/design/colors.ts b/src/design/colors.ts index 0ed7e11..0f00887 100644 --- a/src/design/colors.ts +++ b/src/design/colors.ts @@ -14,10 +14,14 @@ export const colors = { "blue-400": tailwindColors.blue[400], // Android settings tint "blue-500": tailwindColors.blue[500], // iOS settings tint pastel: { - orange: "#F2CAAD", // Home screen planet + orange: "#F2CAAD", // Home screen planet, rotating circle default gray: "#E1E3DC", // Home screen planet green: "#ECE9B7", // Home screen planet "orange-light": "#F1E0D9", // Home screen button "gray-light": "#E7E9E6", // Home screen button + "blue-light": "#ADD8E6", // Rotating circle blue + lilac: "#D8B9FF", // Rotating circle lilac + pink: "#FFB6C1", // Rotating circle pink + "blue-dark": "#0054DB", // Rotating circle dark blue }, }; diff --git a/src/screens/exercise-screen/breathing-animation.tsx b/src/screens/exercise-screen/breathing-animation.tsx index 68df8ce..9817a24 100644 --- a/src/screens/exercise-screen/breathing-animation.tsx +++ b/src/screens/exercise-screen/breathing-animation.tsx @@ -2,8 +2,8 @@ import setColor from "color"; import { useColorScheme } from "nativewind"; import React, { FC, useEffect, useRef } from "react"; import { Animated, View } from "react-native"; -import { colors } from "@breathly/design/colors"; import { shortestDeviceDimension } from "@breathly/design/metrics"; +import { useSettingsStore } from "@breathly/stores/settings"; import { animate } from "@breathly/utils/animate"; import { times } from "@breathly/utils/times"; @@ -12,10 +12,10 @@ const MOUNT_ANIMATION_DURATION = 300; interface Props { animationValue: Animated.Value; - color?: string; + color: string; } -export const BreathingAnimation: FC = ({ animationValue, color = colors.pastel.orange }) => { +export const BreathingAnimation: FC = ({ animationValue, color }) => { const { colorScheme } = useColorScheme(); const mountAnimationValue = useRef(new Animated.Value(0)).current; const innerOpacity = animationValue.interpolate({ diff --git a/src/screens/exercise-screen/exercise-screen.tsx b/src/screens/exercise-screen/exercise-screen.tsx index 5d2c744..6a2db4a 100644 --- a/src/screens/exercise-screen/exercise-screen.tsx +++ b/src/screens/exercise-screen/exercise-screen.tsx @@ -7,6 +7,7 @@ import { Animated, View } from "react-native"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import { Pressable } from "@breathly/common/pressable"; import { RootStackParamList } from "@breathly/core/navigator"; +import { colors } from "@breathly/design/colors"; import { widestDeviceDimension } from "@breathly/design/metrics"; import { AnimatedDots } from "@breathly/screens/exercise-screen/animated-dots"; import { StepDescription } from "@breathly/screens/exercise-screen/step-description"; @@ -103,6 +104,11 @@ const ExerciseRunningFragment: FC = ({ const selectedPatternSteps = useSelectedPatternSteps(); const [unmountContentAnimVal] = useState(new Animated.Value(1)); const stepsMetadata = buildStepsMetadata(selectedPatternSteps); + const { rotatingCircleColorEnabled } = useSettingsStore(); + const { rotatingCircleColor } = useSettingsStore(); + const color = rotatingCircleColorEnabled + ? colors.pastel[rotatingCircleColor] + : colors.pastel.orange; const { currentStep, exerciseAnimVal, textAnimVal } = useExerciseLoop(stepsMetadata); @@ -140,7 +146,7 @@ const ExerciseRunningFragment: FC = ({ {currentStep && ( - + state.setTheme); const vibrationEnabled = useSettingsStore((state) => state.vibrationEnabled); const setVibrationEnabled = useSettingsStore((state) => state.setVibrationEnabled); + const rotatingCircleColorEnabled = useSettingsStore((state) => state.rotatingCircleColorEnabled); + const setRotatingCircleColorEnabled = useSettingsStore( + (state) => state.setRotatingCircleColorEnabled + ); + const rotatingCircleColor = useSettingsStore((state) => state.rotatingCircleColor); + const setRotatingCircleColor = useSettingsStore((state) => state.setRotatingCircleColor); React.useEffect(() => { // Use `setOptions` to update the button that we previously specified @@ -109,6 +115,29 @@ export const SettingsRootScreen: FC< onValueChange={setTheme} /> )} + + {rotatingCircleColorEnabled && ( + + )} unknown; vibrationEnabled: boolean; setVibrationEnabled: (vibrationEnabled: boolean) => unknown; + rotatingCircleColorEnabled: boolean; + setRotatingCircleColorEnabled: (rotatingCircleColorEnabled: boolean) => unknown; + rotatingCircleColor: "blue-light" | "lilac" | "pink" | "blue-dark"; + setRotatingCircleColor: ( + rotatingCircleColor: "blue-light" | "lilac" | "pink" | "blue-dark" + ) => unknown; } export const useSettingsStore = create()( @@ -57,6 +63,11 @@ export const useSettingsStore = create()( setTheme: (theme) => set({ theme }), vibrationEnabled: true, setVibrationEnabled: (vibrationEnabled) => set({ vibrationEnabled }), + rotatingCircleColorEnabled: false, + setRotatingCircleColorEnabled: (rotatingCircleColorEnabled) => + set({ rotatingCircleColorEnabled }), + rotatingCircleColor: "blue-light", + setRotatingCircleColor: (rotatingCircleColor) => set({ rotatingCircleColor }), }), { name: "settings-storage",