expo-color-to-hex
v0.1.2
Published
Expo plugin for converting PlatformColor to RGB HEX
Maintainers
Readme
expo-color-to-hex
Notice: This is third party library, not mainteined by Expo Team offically.
Expo plugin for converting PlatformColor to RGB HEX
Add the package to your npm dependencies
This package has native code, and not available for Expo Go.
# npm
npm install expo-color-to-hex
# yarn
yarn add expo-color-to-hexConfigure for iOS
Run pod install on /ios directory after installing the npm package and prebuild.
To run your app, you should run npx expo run:ios (not work on Expo Go!)
Configure for Android
You should run npx expo prebuild and npx expo run:android (not work on Expo Go!)
Contributing
Contributions are very welcome!
API
API
type ColorName =
| "systemRed"
| "systemBlue"
| "systemFreen"
| "systemOrange"
| "systemYellow"
| "systemPink"
| "systemPurple"
| "systemTeal"
| "systemIndigo"
| "systemGreen"
| "systemGray"
| "systemGray2"
| "systemGray3"
| "systemGray4"
| "systemGray5"
| "systemGray6";
function getColorIOS(colorName: ColorName): string | null {
return null // or #000000 (HEX with `#`)
}
// For Android, any color name is OK.(R.color / R.attr)
function getColorAndroid(colorName: string): string | null {
// If color you input is not found, return null
return null // or #000000 (HEX with `#`)
}Example
const colorIOS = getColorIOS('systemRed')
const colorAndroid = getColorAndroid('@android:color/system_accent1_300')