1671539760
SVG patterns could easily be thought of as an under-appreciated superpower of SVG. While they’re often not widely understood, SVG patterns offer a lot of interesting design options once you understand their subtleties.
In this article, we’re going to start with a crash course on how SVG patterns work. Then we’ll spin through 6 tools that take advantage of them.
In theory, combining the output from these tools with what you know about patterns should open up some exciting, new design possibilities.
Repeating patterns have been a mainstay of web design from the earliest days of Geocities and MySpace ruled the prehistoric internet. Even if you only know a little CSS, you probably understand how easy it is to set up any image as a CSS tiling background.
div {
background-image: url("sitepoint-tile.svg");
}
Of course, we could use any web image format we like for that background (JPG, PNG, etc). But as SVGs are so efficient, sharp and scalable that there are excellent reasons for choosing to use an SVG for your CSS background tiles.
However, you may be less familiar with SVG’s native method to make repeating backgrounds – SVG patterns. It is relevant to us because it offers special powers that regular CSS tiling can’t. But first, let’s look at how a simple SVG pattern works first.
<svg>
<defs>
<pattern id="myPattern"
x="10" y="10" width="20" height="20" patternUnits="userSpaceOnUse" >
<!-- start pattern-->
<circle cx="10" cy="10" r="7" style="stroke: none; fill: magenta" />
<!-- end pattern -->
</pattern>
</defs>
...
At the top of most SVG files you’ll find a <DEFS>
code block. This <DEFS>
section (or DEFinitions) is where we place elements we want to re-use later. In practical terms, this means SVG FILTERs, SYMBOLs and PATTERNs.
Simple SVG patterns
Inside our <DEFS>
block, we’ve set up a 20 x 20px area of pattern. Then we’ve positioned a small magenta circle right in the center (cx=”10″ cy=”10″) of that space (though this could have been any item that we wanted to tile).
But this doesn’t render anywhere – yet. It is just a pattern definition – almost like a color swatch or a CSS class. You’ll need to reference it in one of your SVG FILLs to see it render.
...
<circle cx="50" cy="50" r="50" style="stroke: #ccc; fill: url(#myPattern);" />
</svg>
Here we’re creating a large circle (radius 50px) and filling it by referencing the pattern we defined above. It renders like this.
That’s relatively simple, right? We could scale up that container circle as large as we liked with no increase to the file size whatsoever.
So, are SVG Patterns more useful than CSS background tiling?
They certainly can be.
This allows you build-up complex, layered patterns from very simple components. For instance, how would you produce this Moiré pattern with a standard CSS tile?
SVG allows us to define a ‘base pattern’ – like the dots we created above – and then layer that same pattern with different color fills, rotations and scales (like the sample above). Tiny files but crazy complexities.
I believe this special characteristic opens up a lot of new design possibilities – once you get a feel for the basics.
SVG patterns are very well-supported in all modern browsers, but are NOT ALWAYS supported in your favorite vector editors. To my knowledge:
This shouldn’t be a deal breaker, but just be aware when selecting your tools.
For now, let’s look at some ready-to-use ‘off-the-rack’ SVG pattern options available. Take these as they are, or else use them as a jumping off point for more interesting creations.
Firstly, I have to address the ‘elephant in the room (or web application in this case)’.
I’m truly not certain how to pronounce the name of this selection. Is it ‘ten-thousand-and-fifteen-dot-i-o’? I suspect they are riffing on a L33t-speak spelling of ‘TOOLS.io’. However, for me that barely reads as ‘tools’ even when paired with their ideal geometric logo font.
Can you substitute a ‘1’ as both a ‘T’ and an ‘L’ in the same word? Personally, I would argue no. Maybe that’s just me?
Moving on to the positives…
The ‘SVG Pattern Generator’ itself is part of an impressive 50-strong suite of free online tools on offer. The SVG pattern assets it generates aren’t wildly creative. You can customize the repeating shape, color palette, scale, opacity, rotation, and skew. This nice thing about this tool is:
That makes this generator a handy ‘point-and-click’ sandbox for learning how SVG patterns work. Change a setting. Look at the code. Repeat.
While you’re there, check out their SVG blob generator, CSS Glassmorphism Generator, and Google Fonts Pair Finder.
Just remember to bookmark it – that’s a tough URL to recall ;) .
Hero Patterns, a project by UI designer and illustrator Steve Schoger, remains a good resource.
Steve offers over 90 SVG patterns for free download and allows you to set the opacity, foreground and background colors of your file.
Interestingly, the samples here are not just a bunch square tiles either, which makes it a good place to get an understanding of what you can do with SVG patterns.
In a lot of early 20th century maps and charts, designers often made up for a lack of color printing by using monotone pattern fills with dots, lines, and cross-hashes. Although this was a design limitation of the time, it still presents a crisp, super-efficient option for your SVG fills today.
Iros has collected a pattern book of monotone pattern fills that you can reference in your work easily. These are tiny files and you can probably afford to include them all, even if you only reference a few.
A monsterously large collection of elegantly tiling SVG graphics – around 250 by my count. It’s easy to quickly scale, color, rotate, and reposition the each design.
Pattern Monster lets you export your tile as an CSS-ready SVG code, so you’ll need to code your own SVG pattern definitions to use them within an SVG image.
Sébastien Noël has a jaw-dropping collection of simple, original and beautiful design tools available at his fffuel.co site.
Of this group, his Mmmotif isometric 3d pattern generator is the best fit for this list. Like Pattern Monster, you can mix and match shapes, colors, scaling, and angles, to compose a bumpy 3d isometric tile.
Matt Lipman tipped me off to his SVG generator – SVGBackgrounds.com. This tool currently offers 30 base patterns, but the colors and opacity can be customized with a few clicks. When you’re done, it exports CSS-ready SVG that can be pasted into your stylesheet. As was the case with Pattern Monster, you’ll need to manually code SVG pattern definitions.
Great SVG patterns are a perfect blend of design inspiration and technical know-how, and having good tools to support you certainly helps.
If you’re interested in experimenting with SVG patterns, I wrote a piece on using Boxy SVG to create SVG patterns from scratch. Experimenting with that tool taught me a lot of what I know about patterns now.
Original article source at: https://www.sitepoint.com/
1667765940
Import layers from Sketch to Framer with states. Revolutionary way of semantic import makes iterations with Framer easy & productive. Read More
Have you used a Keynote for prototyping? It’s quite the same but like you organize scene of slides in Sketch and create motion in Framer with a any logic you need. Read More
You are welcome to suggest ideas and report bugs (ideally with sketch files included). For better communication I suggest using Github issues but you can ping @framerinventory on Twitter as well.
Author: Timurnurutdinov
Source Code: https://github.com/timurnurutdinov/Framer-Inventory-for-Sketch
License: Apache-2.0 license
1667761980
A Sketch module for creating a complex UI with a webview. The API is mimicking the BrowserWindow API of Electron.
To use this module in your Sketch plugin you need a bundler utility like skpm and add it as a dependency:
npm install -S sketch-module-web-view
You can also use the with-webview skpm template to have a solid base to start your project with a webview:
skpm create my-plugin-name --template=skpm/with-webview
The version 2.x is only compatible with Sketch >= 51. If you need compatibility with previous versions of Sketch, use the version 1.x
import BrowserWindow from 'sketch-module-web-view'
export default function () {
const options = {
identifier: 'unique.id',
}
const browserWindow = new BrowserWindow(options)
browserWindow.loadURL(require('./my-screen.html'))
}
Author: skpm
Source Code: https://github.com/skpm/sketch-module-web-view
License: MIT license
1667758080
My Finder buttons collection for macOS.
These buttons are built with ScriptEditor. If you'd prefer a native alternative, checkout my Finder extension app, SwiftyMenu: https://apps.apple.com/app/swiftymenu/id1567748223
Download or git clone
the buttons in a proper place. Hold on command button and drag each one into your Finder toolbar.
MyShinnyFinderButton.app/Contents/Resources/Scripts/main.scpt
with Script Editor then you gonna know what to do.iconset
folders from Sketch.iconutil -c icns MyShinnyFinderButton.iconset
)MyShinnyFinderButton.app/Contents/Resources/droplet.icns
with your icns.There's a fork which refined the main script of TerminalButton with Apple Script: https://github.com/ashfinal/LTFinderButtons It fixed some issues of TerminalFinderbutton. But I rejected the PR since Apple Script was not my taste for a long time. Please have a try once you face any problem with TerminalButton.
Author: lexrus
Source Code: https://github.com/lexrus/LTFinderButtons
License: MIT license
1667754240
Plugin for Sketch to create connection flow arrows for creating user flows, sitemaps and many more. Just select two objects and click on "Plugins" → "👉 Connection Arrows" → "Create Connection" and voilà! It will create a connection with arrow 🚀
In our day to day activities, we are creating a lot of diagrams in EPAM. We understood that most of our time we are spending on connecting and drawing arrows for our user flows and to automate that, I created this plugin. You can read full information about the plugin on Medium
The most recent version you can find here: Download the Latest Arrows Sketch Plugin
Create a connection. Select more than one layer in Sketch and click on "Plugins" 👉 "Connection Arrows" 👉 "Create Connection"
Update all connections inside artboard. Select artboard where all the arrows are stored and click on "Plugins" 👉 "Connection Arrows" 👉 "Update Connection" 👉 "From the Selected Artboard"
Delete connection between two layers. Select layers that have a connection and click on "Plugins" 👉 "Connection Arrows" 👉 "Delete Connection" 👉 "Between Selected"
Arrow Direction. By the default you will have an "Auto" mode, that will draw arrows based on the position of the second layer but if you are creating userflows or sitemap, where all the arrows are pointed in one direction, you can specify it in settings
Arrow Spacing. For saving time and not moving all the layers one by one, you can pre-define spacing in settings. When you will create or update connection between two objects, it will automatically move the second layer for a specified amount of pixels ✌️
Arrow Style. Right now you can provide an arrow style in settings. Make sure that the style that you want to specify is used on your Sketch document and it has "$arrow" text in the name.
Arrow Type. You have the ability to select "Straight", "Angled" and "Curved" arrow types in settings. They are saved globally and if you update the connection, the arrow type will be taken from the arrow type that these objects had before. If you want to redraw the arrow and have the type specified in settings, please choose "Create Arrow" action 🚀
Auto-align. If your second object is misaligned for less than 5px with this option turned on the plugin will auto-align the second object based on the direction. So you don't need to spend time aligning everything 🤘
This plugin allows you to provide an arrow between two objects, but for creating user flows and sitemaps you need actual objects to interact with. Don't worry, we got your back!
If you would like to suggest improvement, report a bug or just say "Hi 👋" join our community on Spectrum
You can write me directly via mssg.me/farid or find me on Instagram or Dribbble as @faridsabitov
Author: Faridsabitov
Source Code: https://github.com/faridsabitov/Sketch-Connection-Flow-Arrows
1667750280
Javascript library to manipulate sketch files
npm install node-sketch
const ns = require('node-sketch');
async function run() {
const sketch = await ns.read(__dirname + '/design.sketch');
//Search the symbol named 'button'
const buttonSymbol = sketch.symbolsPage.get('symbolMaster', 'button');
//Search all instances of a symbol named 'old-button' and replace it with 'button'
const firstPage = sketch.pages[0];
firstPage
.getAll('symbolInstance', instance => instance.symbolMaster.name === 'old-button')
.forEach(instance => instance.symbolMaster = buttonSymbol);
//Save the result
sketch.save('modified-design.sketch')
.then(console.log('File saved!!'));
}
run();
Two classes are used to manage sketch files:
Sketch
Represents the sketch file and contains all data (pages, symbols, styles, shapes, etc). Contains the method .save()
to create a sketch file with the result.
const ns = require('node-sketch');
ns.read('input.sketch').then(sketch => {
sketch.document // document data
sketch.meta // meta data
sketch.user // user data
sketch.pages // array with all pages
sketch.symbolsPage // the Symbols page
sketch.layerStyles // array with the layer styles
sketch.textStyles // array with the text styles
sketch.colors // array containing the colors stored in the color palette
sketch.gradients // array containing the gradients stored in the gradient palette
sketch.symbols // array with all symbols stored in the document
sketch.foreignSymbols // array with the symbols loaded from external libraries
sketch.foreignLayerStyles // array with the layer styles loaded from external libraries
sketch.foreignTextStyles // array with the text styles loaded from external libraries
sketch.save('output.sketch');
});
Node
It's the base class used by all other elements. Any page, symbol, color, etc is an instance of this class.
const symbolsPage = sketch.symbolsPage;
console.log(symbolsPage instanceof Node); //true
//It include useful methods to search an inner node by class:
const button = symbolsPage.get('symbolMaster');
//by class and name
const button = symbolsPage.get('symbolMaster', 'button');
//by class and callback
const button = symbolsPage.get('symbolMaster', symbol => symbol.name === 'button');
//Just a callback
const button = symbolsPage.get(node => node._class === 'symbolMaster' && node.name === 'button');
//And the same than above but returning all inner nodes instead just the first:
const allSymbols = symbolsPage.getAll('symbolMaster');
There are other classes extending Node
to provide special funcionalities in some nodes, like Style
or SymbolInstance
.
Technically, the sketch format consist in a zip with some json files. To manipulate a sketch file with this library, you need to know the scheme of json. You can use this code to read and extract a sketch file into a directory, in order to inspect the json scheme:
const ns = require('../');
ns.read('demo.sketch').then(sketch => sketch.saveDir('demo'));
Here you can see an example of extracted file
Starting from v0.14.0, the command node-sketch
was included to use the library from CLI. You only need a file named node-sketch.js
exporting the function to manipulate a sketch file. For example:
module.exports = sketch => {
//Convert the text style names to uppercase
sketch.textStyles.forEach(textStyle => {
textStyle.name = textStyle.name.toUpperCase();
})
}
To execute this script with the sketch file my-styles.sketch
, run node-sketch my-styles.sketch
. By default, the file is readed, but not saved. If you want to override the file with the modifications, run node-sketch my-styles.sketch --save
.
And to execute a script file with a different name, use the --script
argument: node-sketch my-styles.sketch --script=my-script.js --save
.
Or build it locally with npm run docs
Author: oscarotero
Source Code: https://github.com/oscarotero/node-sketch
License: MIT license
1667746380
See your plugin logs, inspect the state of Sketch documents, explore actions, and more.
npm install
)If you want to show some proper logs in the DevTools, you need to use Sketch >= 52.
You might notice performance issues when the DevTools are opened, that's because it's listening to all actions. Closing it will go back to normal.
Lots of room for improvement, let's build it together :) Check out the issues and pick one!
Author: Skpm
Source Code: https://github.com/skpm/sketch-dev-tools
License: MIT license
1667742480
Contains a set of artboard tricks for Sketch. See below for more.
Installation
Download the latest release and double-click the .sketchplugin
file to install.
Or you can install the plugin with Sketch Runner.
The commands
Automatically rearranges your artboards into rows containing an arbitrary number of columns. This is useful for organizing your artboards into distinct "flows", where each row corresponds to a flow.
Rows are 400px apart and columns are 100px apart by default (configurable per page).
The command also re-orders the list of artboards in the sidenav according to its position.
Note that the arrangement is based on the current position of each artboard.
Prefixes each artboard in your page with a number such as 102, 300, 517, etc. based on X and Y position. This is designed to be used with the "Rearrange Artboards Into Grid" command. The first digit is the row, the second 2 digits are the column, like so:
100 101 102
200 201
300 301 302 303 304
Selects the artboard(s) that contain your selection. Useful if you want to select multiple artboards quickly (click and drag to select a bunch of layers, then run this script to select the container artboards).
Author: Romannurik
Source Code: https://github.com/romannurik/Sketch-ArtboardTricks
License: Apache-2.0 license
1667738640
Sketch Plugin Manager uses the power of Git to keep all of your installed plugins up to date.
Sketch Plugin Manager is currently only supported on OS X 10.12 Sierra. A build for 10.11 El Capitan is in the works. To get notified of changes, watch this project on GitHub.
Open the plugin manager from the plugins menu.
Sketch Plugin Manager's Plugin Catalog connects to the Sketch Plugin Directory to let you browse and install plugins available on GitHub.
Every time you start Sketch, Sketch Plugin Manager will check for updates to your installed plugins.
You will be able to review the list of changes before accepting updates to each plugin.
You can manage all of your installed plugins from one place.
Are you fluent in multiple languages? Help translate Sketch Plugin Manager.
To add your plugin to Sketch Plugin Manager, follow the instructions in DEVELOPERS.md.
Author: Mludowise
Source Code: https://github.com/mludowise/Sketch-Plugin-Manager
License: Apache-2.0 license
1667734680
When selecting a new chain, you can apply different transformations to the color property you're chaining (hue/saturation/brightness/alpha). Just specify a percentage to offset the property (i.e If you apply a transformation of -10 on the brightness you will get a color 10% darker.
To update the Chains in your document, just modify your reference layer and select Update all Chains or use [shift cmd u].
To remove Chains, select two chained layers and select Remove All Chains Between Selected Layers, that will erase the chains from the document.
What's Next
If you have an idea for a new feature, create a new Issue or send me a message on Twitter.
Credits
Like it?
If you find Chain useful, consider supporting its development.
Author: lalomts
Source Code: https://github.com/lalomts/Chain
License: GPL-3.0 license
1667730840
Share styles with your team using Google Sheets.
Installation
Install from Sketch Toolbox (recommended) or download the zip, unzip, and open sync.sketchplugin
.
Setting up Google Sheets
You'll need a published sheet to use Sync.
Create a Google Sheet from this template (click the "Use this template" button).
Select File > Publish to web… and then click the Publish button.
Exporting styles
Export styles from Sketch to your sheet. Alternatively, you can skip this step and define your initial styles in the Google Sheets interface.
typography.csv
.typography.csv
into the upload screen and select Replace current sheet then click Import.Importing styles
Import styles from your sheet to Sketch.
Copy the URL to your Google Sheet. (See below if you are using Google Apps at work)
Run the Import
command from the Sync plugin menu and paste your URL into the prompt.
Your text styles, layer styles, and color palette should now be synced with your spreadsheet. Run the plugin again any time to update. Share your published sheet URL with your team to stay in sync.
Some companies prevent employees from publishing sheets. If the Published content & settings drill-down in the Publish to the web modal says that people at your company must log in to view, then Sync will not be able to access your sheet. Don't worry – you can still use Sync for typography. Just visit Sheetsu to generate an API for your new sheet. Use your new Sheetsu URL and continue to step 2.
Font variants—such as bold, italic, or narrow—are actually separate font files on your computer. You should specify these exactly as named in ~/Library/Fonts/
folder on your Mac, excluding the file extension (e.g. ttf
). The Google Sheet template provides an example of this. If you get stuck, consider defining your styles in Sketch and using the export feature.
View the screencast, create an issue or tweet @stan.
Pattern Libraries
Share your pattern library with the Sync community.
Custom API
As an alternative to Google Sheets, you can create a custom JSON api with the following structure. Currently this method only supports typography.
{
…
result: [
{
Style: "Headline 1",
Size: "32",
Color: "DD2E1F",
Opacity: "85",
Typeface: "SourceSansPro-Semibold",
Alignment: "center",
Line: "40",
Character: "0"
},
…
]
}
Run the Import command from the Sync plugin menu and paste your API endpoint URL into the prompt.
Author: Nolastan
Source Code: https://github.com/nolastan/sync.sketchplugin
License: MIT license
1667727000
The Salesforce Lightning Design System (SLDS) UI Kit is a collection of design resources to support designing and prototyping using Lightning Design System components, tokens, and design patterns. There are also useful resources to help make design workflows more efficient with artifacts like page templates, wireframes, key product screens, and components for writing specifications.
Download and install these libraries through the SLDS Plugin for Sketch.
Download and install the most recent version of Sketch.
If you do not have Sketch, you can use the Framer SLDS UI Kit or Figma SLDS UI Kit, however, they may not be as up-to-date as the Sketch files here.
Download and install the most recent version of SLDS Plugin for Sketch.
Download and install Salesforce Sans from the Design System repository.
The installation of SLDS Sketch libraries is handled through the SLDS Plugin for Sketch. Visit the plugin page on the SLDS website to read more.
SLDS Components for Web
Sketch equivalents of component blueprints and tokens as seen on the SLDS website
SLDS Components for Mobile
Sketch collection of native mobile patterns and mobile web coded components
SLDS Icon Library
A file of design system icons which is automatically generated from design system code
Pattern: Builder
Builder design guideline customized component symbols
Pattern: User Engagement
User engagement design guideline customized component symbols
Pattern: Chart
Chart design guideline customized component symbols
Pattern: Rules, Filters, and Logic
RFL design guideline customized component symbols
Standard Artboards
Based on user data, Sketch artboards are sized to the common viewport dimensions used
Spec Library
A collection of symbols to use when documenting dimensions and details of designs for engineers
Wireframes
Grey box stencils of common Lightning interfaces
Key Screens
A collection of the most common product screens on mobile (and desktop coming soon)
The SLDS team welcomes your feedback to help maintain these design resources. Please add any bugs or feature requests under the Issues tab of this repository.
External contributions are currently closed
Throughout a release, Salesforce's design team contributes to these Sketch files through an application called Abstract. Public contributions become unmanagable to review and merge since GitHub doesn't have the capability to view binary files.
Author: Salesforce-ux
Source Code: https://github.com/salesforce-ux/design-system-ui-kit
1667722800
This repo contains the training & testing code for our sketch generator. We also provide a [pre-trained model].
For technical details and the dataset, please refer to the [paper] and the [project page].
Setting up
The code is now updated to use PyTorch 0.4 and runs on Windows, Mac and Linux. For the obsolete version with PyTorch 0.3 (Linux only), please check out the branch pytorch-0.3-obsolete.
Windows users should find the corresponding .cmd
files instead of .sh
files mentioned below.
conda env create -f environment.yml
Then activate the environment (sketch) and you are ready to go!
See here for more information about conda environments.
See environment.yml
for a list of dependencies.
Using the pre-trained model
scripts/test_pretrained.sh
scripts/test_pretrained.sh
It supports a folder of images as input.
Train & test on our contour drawing dataset
Download the images and the rendered sketch from the project page
Unzip and organize them into the following structure:
Modify the path in scripts/train.sh
and scripts/test.sh
From the repo's root directory, run scripts/train.sh
to train the model
From the repo's root directory, run scripts/test.sh
to test on the val set or the test set (specified by the phase flag)
If you use the code or the data for your research, please cite the paper:
@article{LIPS2019,
title={Photo-Sketching: Inferring Contour Drawings from Images},
author={Li, Mengtian and Lin, Zhe and M\v ech, Radom\'ir and and Yumer, Ersin and Ramanan, Deva},
journal={WACV},
year={2019}
}
This code is based on an old version of pix2pix.
Author: Mtli
Source Code: https://github.com/mtli/PhotoSketch
License: View license
1667718960
Convert Storybook stories into Sketch symbols.
Uses the amazing
html-sketchapp
. Only supports web.
Firstly, get Sketch and npm. Then install asketch2sketch.sketchplugin
into Sketch:
Install story2sketch
:
npm i story2sketch -g
Run story2sketch
, pointing towards a Storybook iframe URL. You can find an existing iframe URL in Storybook by clicking 'Open canvas in new tab':
See configuration for more options, or if you have a lot of stories.
story2sketch --url https://localhost:9001/iframe.html --output stories.asketch.json
Import the generated file into Sketch via Plugins > From *Almost* Sketch to Sketch
in Sketch menu bar.
Success!
If you're using Storybook 3.3 or above (but not Storybook 4 or above), you'll want to take full control of your Storybook webpack.config.js if you haven't already done so, adding:
module.exports = (storybookBaseConfig, configType) => {
const newConfig = {
...storybookBaseConfig
};
// Add this:
// Export bundles as libraries so we can access them on page scope.
newConfig.output.library = "[name]";
return newConfig;
};
Manually export the getStorybook
function in your ./config/storybook/config.js
file:
import { getStorybook } from "@storybook/react";
...
export { getStorybook }
Run story2sketch:
story2sketch --url https://localhost:9001/iframe.html --output stories.asketch.json
As stated by react-sketchapp
, it's complicated to manage assets in a design system. Many teams building design systems or component libraries already produce Sketch files for distributing designs and use Storybook to prototype and present the developed components. It can become difficult to keep designs up to date with the latest components, with designers ever playing catchup. story2sketch
generates a Sketch file from your components via Storybook, so your Sketch designs always stay up to date.
You can configure story2sketch
using the API via the CLI, configuring your package.json
or adding a story2sketch.config.js
file.
Simply call story2sketch
with options from the API.
$ story2sketch --stories all --output dist/great-ui.asketch.json
Add the following to your package.json:
{
"story2sketch": {
"stories": "all",
"output": "dist/great-ui.asketch.json"
}
}
Create a file called story2sketch.config.js
on the root of your project:
module.exports = {
output: "dist/great-ui.asketch.json",
stories: "all"
};
Parameter | Explanation | Input Type | Default |
---|---|---|---|
output | Specifies the filename for the generated asketch.json file or a folder when outputBy === 'kind'. | string | "dist/stories.asketch.json" |
input | The location of Storybook's generated iframe.html. Use this over url if possible for performance. | string | "dist/iframe.html" |
url | Storybook iframe URL. Will end in iframe.html . Prefer input for performance if possible. | string | "http://localhost:9001/iframe.html" |
stories | Stories to extract from Storybook. You should probably override the default. | object/string | "all" |
concurrency | Number of headless Chrome tabs to run in parallel. Defaults to number of threads available on your machine. | integer | dynamic |
symbolGutter | Gutter to place between symbols in Sketch. | integer | 100 |
viewports | Viewport configuration. Will be arranged left-to-right by width. Try to avoid changing the key, as this is used to identify the symbol. | object | Mobile viewport (320px wide) and desktop viewport (1920px wide). See example below. |
querySelector | Query selector to select your node on each page. Uses document.querySelectorAll . | string | "#root" |
verbose | Verbose logging output. | boolean | false |
fixPseudo | Attempt to insert real elements in place of pseudo-elements | boolean | false |
puppeteerOptions | Options to be passed directly to puppeteer.launch . See puppeteer docs for usage. | object | {} |
removePreviewMargin | Remove preview margin from the iframe body. | boolean | true |
layoutBy | Group symbols in the sketch output by the "kind" or "group" key | "kind" | "group" | null |
outputBy | Write multiple sketch files by "kind" or the "group" key | "kind" | "group" | null |
Automatically detect the stories, outputting two viewports for each story in a single Sketch file as symbols.
module.exports = {
output: "dist/great-ui.asketch.json",
input: "dist/iframe.html", // Same as default
pageTitle: "great-ui"
};
Manually define stories to have granular control over what stories are output. This might help if you're getting empty output, since some stories may break story2sketch.
module.exports = {
stories: [
{
kind: "Buttons/Button",
stories: [
{
name: "Button"
}
]
},
{
kind: "Buttons/ButtonGroup",
stories: [
{
name: "Default",
displayName: "Horizontal"
},
{
name: "Vertical"
}
]
},
{
kind: "Table",
stories: [
{
name: "Table"
}
]
}
]
};
Output symbols based on custom viewports:
module.exports = {
viewports: {
narrow: {
width: 320,
height: 1200,
symbolPrefix: "Mobile/"
},
standard: {
width: 1920,
height: 1200,
symbolPrefix: "Desktop/"
}
}
};
Outputs one file for each Storybook "kind". Useful if managing large component libraries, allowing you to distribute smaller files.
module.exports = {
output: "dist", // Define output directory. File names are defined by "kind"
outputBy: "kind" // Also supports "group", see below.
};
Renders the sketch layout by kind, but keeps them in one file.
module.exports = {
layoutBy: "kind" // Also supports "group", see below.
};
This example outputs two files based on a custom grouping: dist/Buttons.asketch.json
and dist/Data.asketch.json
.
module.exports = {
output: "dist",
outputBy: "group",
stories: [
{
group: "Buttons",
kind: "Buttons/Button",
stories: [
{
name: "Button"
}
]
},
{
group: "Buttons",
kind: "Buttons/ButtonGroup",
stories: [
{
name: "Default",
displayName: "Horizontal"
},
{
name: "Vertical"
}
]
},
{
group: "Data",
kind: "Table",
stories: [
{
name: "Table"
}
]
}
]
};
If you want story2sketch
to run in a CI environment you might have to add the following configuration to puppeteer in your story2sketch.config.js
.
module.exports = {
puppeteerOptions: {
args: ['--no-sandbox', '--disable-setuid-sandbox']
},
...
};
If your stuff looks bad, either it's not supported by html-sketchapp
yet (see support here), or you need to configure story2sketch.
react-sketchapp
instead of html-sketchapp
?react-sketchapp
only supports React Native, or forces you to use React Native component naming conventions. html-sketchapp
supports good ol' fashioned HTML, and doesn't care what web framework you're using.
Not yet, but we have plans to add support for multiple and custom adaptors.
Author: Chrisvxd
Source Code: https://github.com/chrisvxd/story2sketch
License: View license
1667715120
Create good-looking and perceptually uniform gradients and color scales (using Chroma.js and the Lab color space)
I came across this blog post recently. It opened my eyes to the Lab color space, and how you can use it to create perceptually uniform gradients and color scales with SASS. Chroma.js is the underlying library powering it. Check it out if you want a deeper understanding of the Lab color space and why it's good for creating color scales. Basically, it's a color space that, unlike RGB, was built to mirror the visual response of the human eye. That makes it very well suited for interpolating colors.
I thought this technique would be useful in design tools as well, and was kind of surprised that I couldn't find any Sketch plugins that implemented it. So I created this :)
This command will take the gradient of the selected shape and add new color stops to create a more aesthetically pleasing one.
This command will create a scale between the fill colors of two selected shapes.
npm install
npm run build
Author: Petterheterjag
Source Code: https://github.com/petterheterjag/chromatic-sketch
License: ISC license