All Projects → noeldelgado → Psd Guides

noeldelgado / Psd Guides

📐 JS library to draw photoshop-like guides.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Psd Guides

FixLanguageTypeJs
Tiny Library for fix problem of language selection in type text.
Stars: ✭ 15 (-31.82%)
Mutual labels:  js-library, javascript-library
favicon
🖼 An attempt to capture all possible favicons for a web project.
Stars: ✭ 17 (-22.73%)
Mutual labels:  photoshop, sketch
previewer
A super light-weight JavaScript image previewer [not actively maintained]
Stars: ✭ 24 (+9.09%)
Mutual labels:  js-library, javascript-library
React Color
🎨 Color Pickers from Sketch, Photoshop, Chrome, Github, Twitter & more
Stars: ✭ 10,287 (+46659.09%)
Mutual labels:  photoshop, sketch
kironroy.github.io
Portfolio
Stars: ✭ 14 (-36.36%)
Mutual labels:  photoshop, sketch
Ag Psd
Javascript library for reading and writing PSD files
Stars: ✭ 135 (+513.64%)
Mutual labels:  photoshop, javascript-library
FilterInputJs
Tiny and Powerful Library for limit an entry (text box,input) as number,string or more...
Stars: ✭ 37 (+68.18%)
Mutual labels:  js-library, javascript-library
Sketch
Just a HTML5 sketch-pad.
Stars: ✭ 9 (-59.09%)
Mutual labels:  sketch, javascript-library
awesome-libraries-resources
Awesome js and css libraries for web development.
Stars: ✭ 32 (+45.45%)
Mutual labels:  js-library, javascript-library
boring-avatars
Boring avatars is a tiny JavaScript React library that generates custom, SVG-based avatars from any username and color palette.
Stars: ✭ 3,582 (+16181.82%)
Mutual labels:  sketch, javascript-library
Semantic Ui React
The official Semantic-UI-React integration
Stars: ✭ 12,561 (+56995.45%)
Mutual labels:  js-library, javascript-library
Anychart
AnyChart is a lightweight and robust JavaScript charting solution with great API and documentation. The chart types and unique features are numerous, the library works easily with any development stack.
Stars: ✭ 288 (+1209.09%)
Mutual labels:  js-library, javascript-library
Selection
✨ Selection - A simple and lightweight library to add a visual way of selecting elements, just like on your Desktop. Zero dependencies. Full mobile and scroll support.
Stars: ✭ 1,371 (+6131.82%)
Mutual labels:  js-library, javascript-library
Icondrop
Get access to 2 million+ design resources right inside Adobe Xd, Figma, Sketch, Microsoft Office, G Suite and many more.
Stars: ✭ 174 (+690.91%)
Mutual labels:  photoshop, sketch
Redash
Tiny functional programming suite for JavaScript.
Stars: ✭ 40 (+81.82%)
Mutual labels:  js-library, javascript-library
ChangeNumbersJs
Tiny Library for change number from a language in other language.
Stars: ✭ 14 (-36.36%)
Mutual labels:  js-library, javascript-library
psd-to-sketch-converter
Convert PSD to Sketch for free
Stars: ✭ 42 (+90.91%)
Mutual labels:  photoshop, sketch
Make-This
Project files for the Make This video series and community challenges.
Stars: ✭ 16 (-27.27%)
Mutual labels:  photoshop, sketch
Alfred Font Awesome Workflow
🎩 Font Awesome workflow for Alfred
Stars: ✭ 714 (+3145.45%)
Mutual labels:  photoshop, sketch
Sketchapi
The JavaScript plugin library embedded in Sketch
Stars: ✭ 784 (+3463.64%)
Mutual labels:  sketch

psd-guides

npm-image bower-image

https://noeldelgado.github.io/psd-guides/

psd-guides is a simple script to draw photoshop-like guides.

Can be useful during slicing phase to accomplish pixel-perfect web layouts.

Installation

NPM

npm install psd-guides --save

BOWER

bower install psd-guides --save

Usage

new PSDGuides({
  canvasWidth : 1000,
  horizontalGuides : [20, "355 * 2", 250, 20],
  vericalGuides : [50, "100 * 2", "250 * 2", "50 * 3"]
}).activate();

Tip: While defining your guides, if you have similar values that needs to be repeated several times, instead of writing them all you can use the * character followed by the number you want it to be repeated, for instance: vericalGuides : [10, 10, 10, 10, 10, 20, 30, 20, 30, 20, 30] can be written as verticalGuides : ["10 * 5", "(20, 30) * 3"]

Defaults

{
  canvas : document.body,                 // [DOMElement]
  canvasWidth : 0,                        // [Integer] (pixels)
  alignment : "center",                   // [String] "center"|"left"|"right"
  backColor : "rgba(132, 170, 234, .25)", // [String] Any valid color format
  lineColor : "rgba(73, 141, 255, 1)",    // [String] Any valid color format
  horizontalGuides : [],                  // [Array]
  verticalGuides : [],                    // [Array]
  zindex : 9999                           // [Number]
}

API

activate

/**
 * Display the guides.
 * @property activate <public> [Function]
 * @return this [PSDGuides]
 */

var psd = new PSDGuides({
	canvasWidth : 1000,
	horizontalGuides : [20, "355 * 2", 250],
	verticalGuides : [50, "100 * 2", "250 * 2", "50 * 3"]
});

psd.activate();

deactivate

/**
 * Hide the guides.
 * @property deactivate <public> [Function]
 * @return this [PSDGuides]
 */

psd.deactivate();

update

/**
 * Update the width and height of psd-guides container,
 * remove and create the guides using the guides array references.
 * @property update <public> [Function]
 * @return this [PSDGuides]
 */

psd.update();

destroy

/**
 * Clean all references to other objects and remove DOMElements.
 * @property destroy <public> [Function]
 * @return null
 */

psd.destroy();
// => null

# Removing guides

When guides are removed, you need to call the update or activate method to reflect the changes.

removeHorizontalGuides

/**
 * Clear the horizontal guides array reference.
 * @property removeHorizontalGuides <public> [Function]
 * @return this [PSDGuides]
 */

psd.removeHorizontalGuides();
// console.log( psd.getHorizontalGuides() );
// => []
// console.log( psd.getVerticalGuides() );
// => [50, 100, 100, 250, 250, 50, 50, 50]

removeVerticalGuides

/**
 * Clear the vertical guides array reference.
 * @property removeVerticalGuides <public> [Function]
 * @return this [PSDGuides]
 */

psd.removeVerticalGuides();
// console.log( psd.getVerticalGuides() );
// => []

removeGuides

/**
 * Clear both horizontal and vertical array references.
 * @property removeGuides <public> [Function]
 * @return this [PSDGuides]
 */

psd.removeGuides().update();

# Adding guides

When adding guides, you need to call the update or activate method after to reflect the changes.

addHorizontalGuides

/**
 * Add guides to the _horizontalGuides Array holder.
 * @property addHorizontalGuides <public> [Function]
 * @argument guides <required> [Array]
 * @return this [PSDGuides]
 */

psd.addHorizontalGuides([20, "355 * 2", 250]).update();
// console.log( psd.getHorizontalGuides() );
// => [20, 355, 355, 250]

addVericalGuides

/**
 * Add guides to the _verticalGuides Array holder.
 * @property addVerticalGuides <public> [Function]
 * @argument guides <required> [Array]
 * @return this [PSDGuides]
 */

psd.addVerticalGuides([50, "100 * 2", "250 * 2", "50 * 3"]).update();
// console.log( psd.getVerticalGuides() );
// => [50, 100, 100, 250, 250, 50, 50, 50]

# Getting the guides

Get current saved guides.

getHorizontalGuides

/**
 * Return the current saved horizontal guides.
 * @property getHorizontalGuides <public> [Function]
 * @return this._horizontalGuides [Array]
 */

psd.getHorizontalGuides();
// => [20, 355, 355, 250]

getVerticalGuides

/**
 * Return the current saved vertical guides.
 * @property getVerticalGuides <public> [Function]
 * @return this._verticalGuides [Array]
 */

psd.getVerticalGuides();
// => [50, 100, 100, 250, 250, 50, 50, 50]

Examples (960 Grid System)

Applying 960 grid system

12-column grid

new PSDGuides({
    canvasWidth : 960,
    horizontalGuides : ["(10, 60, 10) * 12"]
}).activate()

16-column grid

new PSDGuides({
    canvasWidth : 960,
    horizontalGuides : ["(10, 40, 10) * 16"]
}).activate();

24-column grid

new PSDGuides({
    canvasWidth : 960,
    horizontalGuides : ["(10, 20, 10) * 24"]
}).activate()

There are more examples inside the examples folder.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].