1
1
/* @flow strict-local */
2
+ // $FlowFixMe[untyped-import]
3
+ import Color from 'color' ;
2
4
import React , { useCallback , useContext , useMemo } from 'react' ;
3
5
import type { Node } from 'react' ;
4
6
import { Platform , View , Alert , Linking , Pressable } from 'react-native' ;
@@ -10,10 +12,11 @@ import * as logging from '../utils/logging';
10
12
import { TranslationContext } from '../boot/TranslationProvider' ;
11
13
import type { Narrow } from '../types' ;
12
14
import { showErrorAlert } from '../utils/info' ;
13
- import { BRAND_COLOR , HIGHLIGHT_COLOR , createStyleSheet } from '../styles' ;
15
+ import { createStyleSheet } from '../styles' ;
14
16
import { IconImage , IconCamera , IconAttach , IconVideo } from '../common/Icons' ;
15
17
import { uploadFile } from '../actions' ;
16
18
import { androidEnsureStoragePermission } from '../lightbox/download' ;
19
+ import { ThemeContext } from '../styles/theme' ;
17
20
import type { SpecificIconType } from '../common/Icons' ;
18
21
19
22
type Props = $ReadOnly < { |
@@ -74,9 +77,18 @@ function MenuButton(props: MenuButtonProps) {
74
77
const { onPress, IconComponent } = props ;
75
78
const style = useMemo ( ( ) => ( { paddingHorizontal : 12 , paddingVertical : 8 } ) , [ ] ) ;
76
79
80
+ const themeData = useContext ( ThemeContext ) ;
81
+
82
+ // TODO: Use standard colors from a palette; don't do this ad-hoc stuff.
83
+ const color : string = useMemo (
84
+ ( ) => Color ( themeData . color ) . fade ( 0.5 ) . toString ( ) ,
85
+ [ themeData . color ] ,
86
+ ) ;
87
+ const pressedColor : string = useMemo ( ( ) => Color ( color ) . fade ( 0.5 ) . toString ( ) , [ color ] ) ;
88
+
77
89
return (
78
90
< Pressable style = { style } onPress = { onPress } >
79
- { ( { pressed } ) => < IconComponent color = { pressed ? HIGHLIGHT_COLOR : BRAND_COLOR } size = { 24 } /> }
91
+ { ( { pressed } ) => < IconComponent color = { pressed ? pressedColor : color } size = { 24 } /> }
80
92
</ Pressable >
81
93
) ;
82
94
}
0 commit comments