Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions index.js

This file was deleted.

43 changes: 43 additions & 0 deletions index.ts
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);
}
}
4 changes: 2 additions & 2 deletions ios/palette/Palette.m
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ - (void)startToAnalyzeForTargetMode:(PaletteTargetMode)mode withCallBack:(GetCol

- (void)startToAnalyzeImage{

dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
@synchronized (self) {

[self clearHistArray];

Expand Down Expand Up @@ -458,7 +458,7 @@ - (void)startToAnalyzeImage{
[self findMaxPopulation];

[self getSwatchForTarget];
});
};

}

Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@

{
"name": "react-native-palette-full",
"version": "1.0.6",
"version": "1.0.8",
"description": "",
"main": "index.js",
"main": "index.ts",
"repository": {
"type": "git",
"url": "https://github.com/jerson/react-native-palette-full"
Expand Down