Skip to content

Commit

Permalink
fix: make alpha value optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Xhale1 committed Sep 20, 2022
1 parent ad2383f commit be50810
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/components/sketch/SketchFields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const SketchFields = ({
<EditableInput
style={{ input: styles.input, label: styles.label }}
label="a"
value={Math.round(rgb.a * 100)}
value={Math.round((rgb.a ?? 1) * 100)}
onChange={handleChange}
dragLabel="true"
dragMax="100"
Expand Down
6 changes: 3 additions & 3 deletions src/types/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ export type Hsl = {
h: number;
l: number;
s: number;
a: number;
a?: number;
};

export type Hsv = {
h: number;
s: number;
v: number;
a: number;
a?: number;
};

export type Rgb = {
r: number;
g: number;
b: number;
a: number;
a?: number;
};

export type Color = Hex | Hsl | Hsv | Rgb;
Expand Down

0 comments on commit be50810

Please sign in to comment.