Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-palette-picker
Advanced tools
Readme
Android Color-palette API implementation for React Native Apps
npm
or yarn
with npm
:
npm install react-native-palette-picker
with yarn
:
yarn add react-native-palette-picker
import React from 'react'
import { getPalette, type ImageColorsResult} from 'react-native-palette-picker';
const useImageColors = () => {
const [colors, setColors] = React.useState<ImageColorsResult>(null);
const [err, setErr] = React.useState<unknown>();
React.useEffect(() => {
const imgUri = "https://i.imgur.com/RCRf1Sx.jpeg";
(async () => {
try {
const res = await getPalette(imgUri, {
fallback: '#ff0000',
fallbackTextColor: '#ffffff',
});
setColors(res);
} catch (error) {
setErr(error);
}
})();
}, []);
return colors
}
getPalette(source: string | number, config?: Config): Promise<ImageColorsResult>
uri
A string which can be:
URL:
Local file:
const img = require('../assets/img.jpg');
Base64:
const base64 = 'data:image/jpeg;base64,/9j/4Ri...';
The mime type prefix for base64 is required (e.g. data:image/png;base64).
Config?
The config object is optional.
Property | Description | Type | Default |
---|---|---|---|
fallback | If a color property couldn't be retrieved, it will default to this hex color string | string | "#000000" |
fallbackTextColor | Text color used when getting color fails.(titleTextColor,bodyTextColor). Must be hex | string | "#FFFFFF" |
ImageColorsResult
Property | Type |
---|---|
dominant | string |
vibrant | string |
darkVibrant | string |
lightVibrant | string |
darkMuted | string |
lightMuted | string |
muted | string |
titleTextColor | string |
bodyTextColor | string |
See the contributing guide to learn how to contribute to the repository and the development workflow.
If you are experienced with iOS development and would like to contribute, please feel free to submit pull requests or open issues related to iOS support. Your contributions will be greatly appreciated and will help make this library more versatile.
MIT
Made with create-react-native-library
FAQs
Android Color-palette API implementation for React Native Apps
The npm package react-native-palette-picker receives a total of 4 weekly downloads. As such, react-native-palette-picker popularity was classified as not popular.
We found that react-native-palette-picker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.