• Stars
    star
    119
  • Rank 297,930 (Top 6 %)
  • Language
    Ruby
  • Created over 12 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Compass mixin for using the dropshadow values that Photoshop uses. Making it easier to convert PSD files to CSS.

Compass plugin to make it easier to work with Photoshop Drop Shadows. Allows you to take the values directly from the Photoshop style dialog and create an identical shadow in pure CSS. Works for Drop Shadow, Inner Shadow, Drop Shadows on text and has some basic support for Inner and Outer Glow.

Installation

Install the Ruby Gem.

gem install compass-photoshop-drop-shadow

Existing Compass Projects

You can include it in any existing Compass project by including the plugin in your config.rb file.

# Require any additional compass plugins here.
require 'compass-photoshop-drop-shadow'

New Compass Projects

You can install the plugin as part of a new Compass project.

compass create my_project -r compass-photoshop-drop-shadow

Usage

@import 'photoshop-drop-shadow';

Examples

// make sure the mixins are imported
@import 'photoshop-drop-shadow';

// Simple shadow
div.box-shadow {
  @include photoshop-drop-shadow(120, 5px, 0, 5px, rgba(#000, 0.75));
}

// Inner shadow
div.inner-box-shadow {
  @include photoshop-inner-shadow(120, 5px, 0, 5px, rgba(#000, 0.75));
}

// Supporting multiple shadows
div.multiple-box-shadow {
  @include box-shadow(
    photoshop-shadow(120, 5px, 0, 5px, rgba(#000, 0.75)),
    photoshop-shadow(120, 5px, 0, 5px, rgba(#000, 0.75), inset)
  );
}

// Text Shadow
h1 {
  // NOTE: $spread has no effect for text shadows
  @include photoshop-text-shadow(120, 5px, 0, 5px, rgba(#000, 0.75));
}

// Multiple Text Shadow
h2 {
  @include text-shadow(
    photoshop-text-shadow(120, 5px, 0, 5px, rgba(#000, 0.75)),
    photoshop-text-shadow(-60, 5px, 0, 5px, rgba(#300, 0.75))
  );
}

Variables

  • $photoshop-global-light: 120deg - Used for the default angle on all shadows. Glow does not use global light.

Functions

  • photoshop-shadow ( [$angle: $photoshop-global-light], [$distance: 0], [$spread: 0], [$size: 0], [$color: #000], [$inner: false] ) - Replicates a PhotoShop Drop Shadow. This function is used by all of the mixins and can also be used for multiple shadows.
  • photoshop-text-shadow ( [$angle: $photoshop-global-light], [$distance: 0], [$spread: 0], [$size: 0], [$color: #000] ) - Replicates a PhotoShop Drop Shadow when applied to text. This function is used by the photoshop-text-shadow mixin and can also be used for applying multiple shadows. This function is also useful for use with plugins such as the textshadow jQuery plugin. Please note that $spread has no effect for CSS text-shadow.
  • photoshop-glow ( [$choke: 0], [$size: 0], [$color: #fff], [$inner: false] ) - Experimental Replicates a PhotoShop Glow. This is used by the experimental glow mixins. Please note that noise, technique, source: center, and quality are not supported.

Mixins

  • photoshop-drop-shadow ( [$angle: $photoshop-global-light], [$distance: 0], [$spread: 0], [$size: 0], [$color: #000] ) - Replicates a PhotoShop Drop Shadow. Please note that blend mode and quality are not supported.
    • $angle - Degrees, unit is optional. Units other than deg are not supported.
    • $distance - Length in pixels, unit required.
    • $spread - Percentage, unit optional, can be expresses as a decimal.
    • $size - Length in pixels, unit required.
    • $color - Color, can be hex, rgb, rgba or hsla. Blend mode is not supported. CSS Opacity is essentially equivalent to "Blend Mode: Normal." "Blend Mode: Multiply" is the same as "normal" when placed over a white background. For an approximation of blend modes in CSS (using the dominant background color), you might try to the experimental blend modes plugin. Dynamic blend modes are not possible in CSS because they require per-pixel color blending.
  • photoshop-inner-shadow ( [$angle: $photoshop-global-light], [$distance: 0], [$spread: 0], [$size: 0], [$color: #000] ) - Replicates a PhotoShop Inner Shadow. Please note that blend mode and quality are not supported.
  • photoshop-text-shadow ( [$angle: $photoshop-global-light], [$distance: 0], [$spread: 0], [$size: 0], [$color: #000] ) - Replicates a PhotoShop Drop Shadow when applied to a text layer. Please note that $spread has no effect for CSS text-shadow. There is an open task in Firefox to support the spread radius for text shadow. In Photoshop, text-shadow is applied by adding a Drop Shadow to a text layer. Inner Shadow or inset is not supported on text-shadow. For text-shadow support in IE9 and below, consider the textshadow jQuery plugin. Please note that blend mode and quality are not supported.
  • photoshop-outer-glow ( [$choke: 0], [$size: 0], [$color: #fff] ) - Experimental Replicates a Photoshop Outer Glow. Please note that noise, gradient, technique, and quality are not supported.
  • photoshop-inner-glow ( [$choke: 0], [$size: 0], [$color: #fff] ) - Experimental Replicates a Photoshop Inner Glow. Please note that noise, gradient, technique, source: center, and quality are not supported.

More Repositories

1

scss-blend-modes

Using standard color blending functions in SASS.
CSS
821
star
2

transform

jQuery 2d transformation plugin
JavaScript
437
star
3

textshadow

An IE compatible text-shadow polyfill.
JavaScript
88
star
4

Units

JavaScript library for converting CSS units.
JavaScript
59
star
5

compass-grid-plugin

Compass grid plugin inspired by the 1KB CSS grid. Supports fixed and fluid grids.
Ruby
50
star
6

curve

Functions for drawing time-based curves.
JavaScript
22
star
7

react-redux-notes

Notes on using React-Redux
17
star
8

ace-mode-twig

A mode for the Ace JavaScript text editor for highlighting Twig templates.
JavaScript
12
star
9

transform3d

a jQuery library for faking 3d transformations in all browsers.
JavaScript
11
star
10

docker-wordpress-starterkit

Starter kit for running Wordpress in development using Docker
Shell
11
star
11

1KB-SCSS-Grid

SCSS Grid based on -- but different than -- the 1KB CSS Grid (http://1kbgrid.com/)
Ruby
9
star
12

corners

jQuery Corners
Ruby
5
star
13

holy-grail-app

Example create react app with server-side rendering and critical style loading
JavaScript
5
star
14

compass-sprockets

tool for watching a directory and using Sprockets to combine and minify the files.
Ruby
5
star
15

redux-saga-watch-actions

Convenience methods for creating a saga that watches for actions
JavaScript
5
star
16

fetch-actions

Dispatch actions to handle fetch requests
JavaScript
4
star
17

redux-selectors

Helpers for creating state selectors in a redux application
JavaScript
3
star
18

jquery.truncate

Truncate text to be a specific height.
JavaScript
2
star
19

blog

JavaScript
2
star
20

ace-mode-freemarker

FreeMarker mode for Ace JavaScript editor.
JavaScript
2
star
21

neutrino-preset-standard

Standard JS preset for Neutrino http://standardjs.com/
JavaScript
1
star