Last Updated on : 2022-06-28 13:28:52download
yarn add @tuya-rn/tuya-native-lamp-elements@2.0.5;
import { ColorUtils } from '@tuya-rn/tuya-native-lamp-elements/lib/utils';
Method | Feature | Parameter | Remarks |
---|---|---|---|
brightKelvin2rgba | Convert the brightness and color temperature values of white light to red, green, blue, alpha (RGBA) color values. | (bright: number, kelvin: number) | bright : brightness kelvin : color temperature |
hsv2rgba | Convert HSV color values to RGBA color values. | (hue: number, saturation: number, bright: numbe) | None |
bright2Opacity | Generate brightness with respective transparency. | (brightness: number, option: { min: number; max: number } = { min: 0.2, max: 1 }) | None |
brightKelvin2rgb | Convert the brightness and color temperature values of white light to red, green, blue, alpha (RGBA) color values. | (bright = 1000,kelvin = 1000,{ temperatureMin = 4000, temperatureMax = 8000 } = {}) | None |
import { ColorUtils } from '@tuya-rn/tuya-native-lamp-elements/lib/utils';
ColorUtils.brightKelvin2rgba(700, 1000); //rgba(224, 232, 255, 0.76)
ColorUtils.hsv2rgba(0, 1000,1000); //rgb(225,0, 0)
ColorUtils.bright2Opacity(700, { min: 0.5 }); //0.85
ColorUtils.brightKelvin2rgb(700, 1000); //rgb(157, 162, 179)
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback