Last Updated on : 2023-12-18 06:18:57download
yarn add @tuya/tuya-panel-lamp-sdk
import { Utils } from '@tuya/tuya-panel-lamp-sdk';
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 { Utils } from '@tuya/tuya-panel-lamp-sdk';
Utils.ColorUtils.brightKelvin2rgba(700, 1000); //rgba(224, 232, 255, 0.76)
Utils.ColorUtils.hsv2rgba(0, 1000,1000); //rgb(225,0, 0)
Utils.ColorUtils.bright2Opacity(700, { min: 0.5 }); //0.85
Utils.ColorUtils.brightKelvin2rgb(700, 1000); //rgb(157, 162, 179)
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback