feat: remove colorspace option from pastel gradients (not supported by API)
This commit is contained in:
@@ -6,7 +6,6 @@ import { PaletteGrid } from '@/components/pastel/color/PaletteGrid';
|
||||
import { ExportMenu } from '@/components/pastel/tools/ExportMenu';
|
||||
import { Button } from '@/components/ui/Button';
|
||||
import { Input } from '@/components/ui/Input';
|
||||
import { Select } from '@/components/ui/Select';
|
||||
import { useGenerateGradient } from '@/lib/pastel/api/queries';
|
||||
import { Loader2, Plus, X } from 'lucide-react';
|
||||
import { toast } from 'sonner';
|
||||
@@ -14,9 +13,6 @@ import { toast } from 'sonner';
|
||||
export default function GradientPage() {
|
||||
const [stops, setStops] = useState<string[]>(['#ff0099', '#0099ff']);
|
||||
const [count, setCount] = useState(10);
|
||||
const [colorspace, setColorspace] = useState<
|
||||
'rgb' | 'hsl' | 'hsv' | 'lab' | 'oklab' | 'lch' | 'oklch'
|
||||
>('lch');
|
||||
const [gradient, setGradient] = useState<string[]>([]);
|
||||
|
||||
const generateMutation = useGenerateGradient();
|
||||
@@ -26,7 +22,6 @@ export default function GradientPage() {
|
||||
const result = await generateMutation.mutateAsync({
|
||||
stops,
|
||||
count,
|
||||
colorspace,
|
||||
});
|
||||
setGradient(result.gradient);
|
||||
toast.success(`Generated ${result.gradient.length} colors`);
|
||||
@@ -111,31 +106,6 @@ export default function GradientPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<Select
|
||||
label="Color Space"
|
||||
value={colorspace}
|
||||
onChange={(e) =>
|
||||
setColorspace(
|
||||
e.target.value as
|
||||
| 'rgb'
|
||||
| 'hsl'
|
||||
| 'hsv'
|
||||
| 'lab'
|
||||
| 'oklab'
|
||||
| 'lch'
|
||||
| 'oklch'
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="rgb">RGB</option>
|
||||
<option value="hsl">HSL</option>
|
||||
<option value="hsv">HSV</option>
|
||||
<option value="lab">Lab</option>
|
||||
<option value="oklab">OkLab</option>
|
||||
<option value="lch">LCH</option>
|
||||
<option value="oklch">OkLCH (Recommended)</option>
|
||||
</Select>
|
||||
|
||||
<Button
|
||||
onClick={handleGenerate}
|
||||
disabled={generateMutation.isPending || stops.length < 2}
|
||||
|
||||
@@ -125,7 +125,6 @@ export interface ColorManipulationData {
|
||||
export interface ColorMixRequest {
|
||||
colors: string[];
|
||||
fraction: number;
|
||||
colorspace?: 'rgb' | 'hsl' | 'hsv' | 'lab' | 'oklab' | 'lch' | 'oklch';
|
||||
}
|
||||
|
||||
export interface ColorMixData {
|
||||
@@ -163,13 +162,11 @@ export interface DistinctColorsData {
|
||||
export interface GradientRequest {
|
||||
stops: string[];
|
||||
count: number;
|
||||
colorspace?: 'rgb' | 'hsl' | 'hsv' | 'lab' | 'oklab' | 'lch' | 'oklch';
|
||||
}
|
||||
|
||||
export interface GradientData {
|
||||
stops: string[];
|
||||
count: number;
|
||||
colorspace: string;
|
||||
gradient: string[];
|
||||
}
|
||||
|
||||
|
||||
@@ -313,7 +313,6 @@ export class PastelWASMClient {
|
||||
return {
|
||||
stops: request.stops,
|
||||
count: request.count,
|
||||
colorspace: request.colorspace || 'rgb',
|
||||
gradient,
|
||||
};
|
||||
}
|
||||
@@ -336,7 +335,6 @@ export class PastelWASMClient {
|
||||
return {
|
||||
stops: request.stops,
|
||||
count: request.count,
|
||||
colorspace: request.colorspace || 'rgb',
|
||||
gradient,
|
||||
};
|
||||
});
|
||||
@@ -458,7 +456,6 @@ export class PastelWASMClient {
|
||||
'colors/names',
|
||||
],
|
||||
formats: ['hex', 'rgb', 'hsl', 'hsv', 'lab', 'lch'],
|
||||
color_spaces: ['rgb', 'hsl', 'hsv', 'lab', 'lch'],
|
||||
distance_metrics: ['cie76', 'ciede2000'],
|
||||
colorblindness_types: ['protanopia', 'deuteranopia', 'tritanopia'],
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user