颜色选择杆的背景定义改为直接定义渐变。

This commit is contained in:
徐涛 2024-12-31 11:15:57 +08:00
parent 795c97f36d
commit 71978c1357
2 changed files with 6 additions and 11 deletions

View File

@ -7,8 +7,7 @@ type ColorRangePickerProps = {
title: string; title: string;
value?: number; value?: number;
onChange: (value: number) => void; onChange: (value: number) => void;
startColor: string; gradient: string;
endColor: string;
min?: number; min?: number;
max: number; max: number;
step?: number; step?: number;
@ -19,8 +18,7 @@ export function ColorRangePicker({
title, title,
value = 0, value = 0,
onChange, onChange,
startColor, gradient,
endColor,
min = 0, min = 0,
max = 100, max = 100,
step = 1, step = 1,
@ -53,7 +51,7 @@ export function ColorRangePicker({
min={min} min={min}
max={max} max={max}
step={step} step={step}
style={{ background: `linear-gradient(to right, ${startColor} 0%, ${endColor} 100%)` }} style={{ background: gradient }}
/> />
</div> </div>
); );

View File

@ -40,8 +40,7 @@ export function RGBAssemble({ color = '000000', onChange }: RGBAssembleProps) {
<div> <div>
<ColorRangePicker <ColorRangePicker
title="Red" title="Red"
startColor="rgb(0, 0, 0)" gradient="linear-gradient(to right, #000000, #ff0000)"
endColor="rgb(255, 0, 0)"
max={255} max={255}
step={1} step={1}
value={r} value={r}
@ -49,8 +48,7 @@ export function RGBAssemble({ color = '000000', onChange }: RGBAssembleProps) {
/> />
<ColorRangePicker <ColorRangePicker
title="Green" title="Green"
startColor="rgb(0, 0, 0)" gradient="linear-gradient(to right, #000000, #00ff00)"
endColor="rgb(0, 255, 0)"
max={255} max={255}
step={1} step={1}
value={g} value={g}
@ -58,8 +56,7 @@ export function RGBAssemble({ color = '000000', onChange }: RGBAssembleProps) {
/> />
<ColorRangePicker <ColorRangePicker
title="Blue" title="Blue"
startColor="rgb(0, 0, 0)" gradient="linear-gradient(to right, #000000, #0000ff)"
endColor="rgb(0, 0, 255)"
max={255} max={255}
step={1} step={1}
value={b} value={b}