Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ziyafenn committed Aug 18, 2020
2 parents d286048 + 299e5e2 commit 457709f
Showing 1 changed file with 15 additions and 47 deletions.
62 changes: 15 additions & 47 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,24 @@
# json-color-palette-generator
# Sketch JSON Color Palette Importer
Create shared layer styles by importing JSON color palettes

_This plugin was created using `skpm`. For a detailed explanation on how things work, checkout the [skpm Readme](https://github.com/skpm/skpm/blob/master/README.md)._
## Description
This plugin will add all the colors from the JSON and create a shared layer styles out of them to be used inside your project.

## CLI Commands
## Supported JSON Format

``` bash
# build with hot reload
npm run watch

# build for production
npm run build
```

## Custom Configuration

### Babel

To customize Babel, you have two options:

* You may create a [`.babelrc`](https://babeljs.io/docs/usage/babelrc) file in your project's root directory. Any settings you define here will overwrite matching config-keys within skpm preset. For example, if you pass a "presets" object, it will replace & reset all Babel presets that skpm defaults to.

* If you'd like to modify or add to the existing Babel config, you must use a `webpack.skpm.config.js` file. Visit the [Webpack](#webpack) section for more info.

### Webpack

To customize webpack create `webpack.skpm.config.js` file which exports function that will change webpack's config.

```js
/**
* Function that mutates original webpack config.
* Supports asynchronous changes when promise is returned.
*
* @param {object} config - original webpack config.
* @param {boolean} isPluginCommand - wether the config is for a plugin command or a resource
**/
module.exports = function (config, isPluginCommand) {
/** you can change config here **/
{
PALETTE_NAME: {
COLOR_LABEL: COLOR_HEX,
...
}
...
}
```

## Debugging

To view the output of your `console.log`, you have a few different options:
* Open `Console.app` and look for the sketch logs
* Use Safari's web inspector to debug your plugin's javascript context
* Look at the `~/Library/Logs/com.bohemiancoding.sketch3/Plugin Output.log` file

Skpm provides a convenient way to do the latter:

```bash
skpm log
```
You can use [Material Design Palette Generator](https://materialpalettes.com/) to generate accessible color palettes and export them in JSON that will work with this plugin without any modifications.
You can also use [ColorBox by Lyft Design](https://www.colorbox.io/) to generate a color palette, but it will require slight modification to the JSON code to make it work with the plugin.

The `-f` option causes `skpm log` to not stop when the end of logs is reached, but rather to wait for additional data to be appended to the input

## Troubleshooting
If you have any problem with importing JSON code, try to validate it first and then format/prettify it. For validation and formatting you can use any available online tool, such as https://jsonformatter.org/

0 comments on commit 457709f

Please sign in to comment.