Skip to content

Commit

Permalink
fix: Filter disabled fills and borders color
Browse files Browse the repository at this point in the history
fix #88
  • Loading branch information
Michele committed Aug 29, 2019
1 parent 91a1228 commit 672057e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/helpers/get-colors.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {
Layer, Page, Group, Selection,
Layer, Page, Group, Selection, Fill, Border
} from 'sketch'; // eslint-disable-line import/no-unresolved

export const getParents = (parents: any[], id: { id: string, type: string, name: string }) => [...parents, id];

export const hasBorder = (layer: any) => !!layer.style.borders.length;
export const hasBorder = (layer: any): boolean => !!layer.style.borders.filter((border: Border) => border.enabled).length;

export const hasFill = (layer: any) => !!layer.style.fills.length;
export const hasFill = (layer: any): boolean => !!layer.style.fills.filter((fill: Fill) => fill.enabled).length;

export const hasTextColor = (layer: any) => !!layer.style.textColor;

Expand Down
2 changes: 2 additions & 0 deletions typings/sketch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ declare module 'sketch' {

export interface Fill {
color: string;
enabled: boolean;
}

export interface Border {
color: string;
enabled: boolean;
}

export interface Selection {
Expand Down

0 comments on commit 672057e

Please sign in to comment.