|
|
@@ -4,24 +4,11 @@ import { ColorType } from '@/context/themes/color'
|
|
|
import { useState } from 'react';
|
|
|
import { rpxToPx } from '@/utils/tools';
|
|
|
|
|
|
-export default function (props: { onChanged?: Function }) {
|
|
|
- const colors = [
|
|
|
- '#00ffff', '#1cf2ff', '#39e6ff', '#56d9ff', '#73cdff', '#90c1ff', '#adb4ff', '#caa8ff', '#e79bff', '#ffaeff', '#ffffff',
|
|
|
- '#ffebe5',
|
|
|
- '#ffd7cc',
|
|
|
- '#ffc2b2',
|
|
|
- '#ffae99',
|
|
|
- '#ff9a7f',
|
|
|
- '#ff8656',
|
|
|
- '#ff723c',
|
|
|
- '#ff5e23',
|
|
|
- '#ff4909',
|
|
|
- '#ff7a4e'
|
|
|
- ]
|
|
|
+export default function (props: { onChanged?: Function,value?:number }) {
|
|
|
|
|
|
const [brightness, setBrightness] = useState(0);
|
|
|
const [isSliding, setIsSliding] = useState(false);
|
|
|
- const [value, setValue] = useState(0)
|
|
|
+ const [value, setValue] = useState(props.value?props.value:0)
|
|
|
const [startX, setStartX] = useState(0);
|
|
|
|
|
|
const handleTouchStart = (event) => {
|
|
|
@@ -57,11 +44,6 @@ export default function (props: { onChanged?: Function }) {
|
|
|
|
|
|
};
|
|
|
|
|
|
- function getColor() {
|
|
|
- var index = Math.round((brightness / 100) * 20)
|
|
|
- return colors[index];
|
|
|
- }
|
|
|
-
|
|
|
function calculateOpacity(number) {
|
|
|
if (number === 0 || number === 100) {
|
|
|
return 1;
|