Skip to content

Instantly share code, notes, and snippets.

View doc22940's full-sized avatar

Acampbell doc22940

View GitHub Profile
{
"name": "flare",
"children": [
{
"name": "analytics",
"children": [
{
"name": "cluster",
"children": [
{ "name": "AgglomerativeCluster", "size": 3938 },
{
"comment": "This is the settings file for the SVGO Compressor Plugin. For more info, please check <https://github.com/BohemianCoding/svgo-compressor>",
"pretty": true,
"indent": 2,
"floatPrecision": 3,
"plugins": [
{
"name": "removeDoctype",
"enabled": true
},
@doc22940
doc22940 / svgo.json
Created April 9, 2020 12:12 — forked from alexjlockwood/svgo.json
A customized SVGO (github.com/svg/svgo) config for use with the Sketch SVGO Compressor plugin (github.com/BohemianCoding/svgo-compressor).
{
"comment": "This is the settings file for the SVGO Compressor Plugin. For more info, please check <https://github.com/BohemianCoding/svgo-compressor>",
"pretty": true,
"indent": 2,
"floatPrecision": 3,
"plugins": [
{
"name": "removeDoctype",
"enabled": true
},
{"v":"5.2.1","fr":60,"ip":0,"op":66,"w":1000,"h":1000,"nm":"Lyft_AmpPaired_Streak_003","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 4","parent":10,"td":1,"sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[0,0,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"d":1,"ty":"el","s":{"a":0,"k":[1000,1000],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"nm":"Ellipse Path 1","mn":"ADBE Vector Shape - Ellipse","hd":false},{"ty":"fl","c":{"a":0,"k":[0.482352942228,0.1254902035,0.976470589638,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tr","p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Ellipse 1","np":2,"cix":2,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":66,"
//
// The Scripter environment.
//
// What's declared in there is available to scripts in their global namespace.
//
// symbolic type aliases
type int = number
type float = number
type byte = number
@doc22940
doc22940 / generate-style-descriptions.ts
Created April 9, 2020 12:10 — forked from alexjlockwood/generate-style-descriptions.ts
Generates style descriptions for each color style in the current Figma file.
// Get the list of color styles in the current Figma file.
const colorStyles = figma.getLocalPaintStyles();
const updatedColorStyles = colorStyles.filter(style => {
const { paints } = style;
if (paints.length !== 1) {
// Skip styles containing multiple colors.
return false;
}
const [paint] = paints;
@doc22940
doc22940 / cleanup-figma-names.ts
Created April 9, 2020 12:10 — forked from alexjlockwood/cleanup-figma-names.ts
Cleans up Figma component and style names
const components = figma.root.children.flatMap(pageNode => {
return pageNode.findAll(node => node.type === 'COMPONENT');
});
const styles = [
...figma.getLocalEffectStyles(),
...figma.getLocalGridStyles(),
...figma.getLocalPaintStyles(),
...figma.getLocalTextStyles(),
];
@doc22940
doc22940 / flatten-icons.ts
Created April 9, 2020 12:10 — forked from alexjlockwood/flatten-icons.ts
Flattens all components in a Figma file. Note that this script assumes that (1) every component in the file is an icon, (2) each icon contains a single color, and (3) the icons don't use masks. The `figma.flatten` function may not work as you expect if one of these conditions aren't met.
// Create a list of all component nodes in the Figma file.
const componentNodes = figma.root.children.flatMap(pageNode => {
return pageNode.findAll(node => node.type === 'COMPONENT');
}) as readonly ComponentNode[];
// Create a list of component nodes that have more than one child node.
const unflattenedComponentNodes = componentNodes.filter(componentNode => {
const childrenNodes = componentNode.findAll(() => true);
return childrenNodes.length > 1;
});
@doc22940
doc22940 / delete-unused-component.ts
Created April 9, 2020 12:09 — forked from alexjlockwood/delete-unused-component.ts
Deletes the selected component if it is private and unused in the file.
if (figma.currentPage.selection.length !== 1) {
figma.notify("🚫 Select a component");
return;
}
const [componentNode] = figma.currentPage.selection;
if (componentNode.type !== "COMPONENT") {
figma.notify("🚫 Select a component");
return;
}
@doc22940
doc22940 / print-unlinked-colors.ts
Created April 9, 2020 12:09 — forked from alexjlockwood/print-unlinked-colors.ts
Prints nodes that have fill/stroke colors that aren't linked to a style.
figma.root.children
.flatMap(pageNode => pageNode.findAll(n => true))
.forEach(node => {
if ('fills' in node && 'fillStyleId' in node) {
if (node.fills !== figma.mixed && node.fills.length > 0 && node.fillStyleId !== '') {
print(`${node.name}'s fill color is not linked to a style`);
}
}
if ('strokes' in node && 'strokeStyleId' in node) {
if (node.strokes.length > 0 && node.strokeStyleId !== '') {