-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from novemberfiveco-engineering/master
Convert to Typescript, Fix thread issue
- Loading branch information
Showing
4 changed files
with
47 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { NativeModules } from 'react-native'; | ||
|
||
const { RNPalette } = NativeModules; | ||
|
||
export enum ISwatchType { | ||
vibrant = 'Vibrant', | ||
vibrantDark = 'Vibrant Dark', | ||
vibrantLight = 'Vibrant Light', | ||
muted = 'Video', | ||
mutedDark = 'Muted Dark', | ||
mutedLight = 'Muted Light', | ||
} | ||
|
||
export interface ISwatch { | ||
color: string; | ||
} | ||
|
||
export interface IPalette { | ||
[key: string]: ISwatch; | ||
} | ||
|
||
const TAG = '[Palette]'; | ||
export default class Palette { | ||
static getNamedSwatchesFromUrl(url: string): IPalette { | ||
__DEV__ && console.debug(TAG, 'getNamedSwatchesFromUrl', url); | ||
return RNPalette.getNamedSwatchesFromUrl(url); | ||
} | ||
|
||
static getAllSwatchesFromUrl(url: string): ISwatch[] { | ||
__DEV__ && console.debug(TAG, 'getAllSwatchesFromUrl', url); | ||
return RNPalette.getAllSwatchesFromUrl(url); | ||
} | ||
|
||
static getNamedSwatches(path: string): IPalette { | ||
__DEV__ && console.debug(TAG, 'getNamedSwatches', path); | ||
return RNPalette.getNamedSwatches(path); | ||
} | ||
|
||
static getAllSwatches(path: string): ISwatch[] { | ||
__DEV__ && console.debug(TAG, 'getAllSwatches', path); | ||
return RNPalette.getAllSwatches(path); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters