sass-softlight 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +31 -5
- data/lib/sass-softlight.rb +3 -3
- data/sass-softlight.gemspec +2 -6
- metadata +51 -36
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Sass::Softlight
|
2
2
|
|
3
|
-
|
3
|
+
SassScript extension to bring the math behind Photoshop's powerful softlight gradient blending mode to Sass, which eliminates the need for manually making softlight gradient backgrounds.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -10,7 +10,7 @@ Add this line to your application's Gemfile:
|
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
13
|
-
$ bundle
|
13
|
+
$ bundle install
|
14
14
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
@@ -18,12 +18,38 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
The script extends Sass's default script functions so you can make a method call to softlight() in your .sass or .scss files as you would with other Sass functions:
|
22
|
+
|
23
|
+
background-image: -webkit-linear-gradient( softlight( $color1, $color2 ), softlight( $color1, $color2 ) )
|
24
|
+
|
25
|
+
The softlight method takes to arguments: the source color and the canvas color (in that order). Both colors must be [Sass Color objects](http://sass-lang.com/docs/yardoc/Sass/Script/Color.html).
|
26
|
+
|
27
|
+
If you want to use the gradient blending mode as it appears in Photoshop then use one color and mix it with white and black using the softlight method:
|
28
|
+
|
29
|
+
background-image: -webkit-linear-gradient( softlight( white, $color2 ), softlight( black, $color2 ) )
|
30
|
+
|
31
|
+
**NOTE:** Gem installing is currently not working. To work around this issue, download sass-softlight.rb and place it in your Rails load path (_your_app_dir/lib/_ or _your_app_dir/config/initializers/_). Stop your server and reset your application's cache:
|
32
|
+
|
33
|
+
$ bundle exex rake tmp:clear
|
34
|
+
|
35
|
+
Restart your server. The softlight method should compile in the Sass just fine now.
|
22
36
|
|
23
37
|
## Contributing
|
24
38
|
|
25
39
|
1. Fork it
|
26
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
40
|
+
2. Create your feature branch (`git checkout -b feature/my-new-feature`)
|
27
41
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
42
|
+
4. Push to the branch (`git push origin feature/my-new-feature`)
|
29
43
|
5. Create new Pull Request
|
44
|
+
|
45
|
+
## Credits
|
46
|
+
|
47
|
+
Written by [Albert Tholen](mailto:albert@getlua.com).
|
48
|
+
|
49
|
+
Sponsored by [Lua Technologies, Inc.](http://getlua.com)
|
50
|
+
|
51
|
+
### Sources
|
52
|
+
|
53
|
+
+ [Adobe Developer Spec PDF Reference, 3rd Ed.](http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf), page 414.
|
54
|
+
+ [W3C SVG Alpha Compositing Spec](http://www.w3.org/TR/SVGCompositing/)
|
55
|
+
|
data/lib/sass-softlight.rb
CHANGED
@@ -59,8 +59,8 @@ module Sass::Script::Functions
|
|
59
59
|
Sass::Script::assert_type source, :Color
|
60
60
|
Sass::Script::assert_type canvas, :Color
|
61
61
|
|
62
|
-
src = { r
|
63
|
-
dest = { r
|
62
|
+
src = { :r => source.red, :g => source.green, :b => source.blue, :alpha => source.alpha }
|
63
|
+
dest = { :r => canvas.red, :g => canvas.green, :b => canvas.blue, :alpha => canvas.alpha }
|
64
64
|
|
65
65
|
alpha_s = src[:alpha]
|
66
66
|
alpha_d = dest[:alpha]
|
@@ -78,7 +78,7 @@ module Sass::Script::Functions
|
|
78
78
|
end
|
79
79
|
composite[ :alpha ] = alpha_r
|
80
80
|
c = unscale( composite )
|
81
|
-
Sass::Script::Color.new( { red
|
81
|
+
Sass::Script::Color.new( { :red => c[:r], :green => c[:g], :blue => c[:b], :alpha => c[:alpha] } )
|
82
82
|
end
|
83
83
|
|
84
84
|
declare :softlight, :args => [:source, :canvas]
|
data/sass-softlight.gemspec
CHANGED
@@ -5,16 +5,12 @@ Gem::Specification.new do |gem|
|
|
5
5
|
gem.email = ["albert@luatechnologies.com"]
|
6
6
|
gem.description = %q{SassScript extension to bring the math behind Photoshop's powerful soft-light gradient blending mode to Sass, which eliminates the need for making soft-light gradient backgrounds manually.}
|
7
7
|
gem.summary = %q{Photoshop soft light blending mode in SassScript}
|
8
|
-
gem.homepage = ""
|
8
|
+
gem.homepage = "https://rubygems.org/gems/sass-softlight"
|
9
9
|
|
10
|
-
# gem.files = ['lib/sass-softlight.rb']
|
11
10
|
gem.files = `git ls-files`.split($\)
|
12
|
-
# gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
-
# gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
11
|
gem.name = "sass-softlight"
|
15
12
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = "0.0.
|
13
|
+
gem.version = "0.0.2"
|
17
14
|
|
18
|
-
# gem.add_development_dependency "rspec", "~> 2.6"
|
19
15
|
gem.add_dependency "sass"
|
20
16
|
end
|
metadata
CHANGED
@@ -1,41 +1,46 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass-softlight
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Albert Tholen
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2012-08-01 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: sass
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
34
|
+
description: SassScript extension to bring the math behind Photoshop's powerful soft-light gradient blending mode to Sass, which eliminates the need for making soft-light gradient backgrounds manually.
|
35
|
+
email:
|
34
36
|
- albert@luatechnologies.com
|
35
37
|
executables: []
|
38
|
+
|
36
39
|
extensions: []
|
40
|
+
|
37
41
|
extra_rdoc_files: []
|
38
|
-
|
42
|
+
|
43
|
+
files:
|
39
44
|
- .gitignore
|
40
45
|
- Gemfile
|
41
46
|
- LICENSE
|
@@ -43,28 +48,38 @@ files:
|
|
43
48
|
- Rakefile
|
44
49
|
- lib/sass-softlight.rb
|
45
50
|
- sass-softlight.gemspec
|
46
|
-
homepage:
|
51
|
+
homepage: https://rubygems.org/gems/sass-softlight
|
47
52
|
licenses: []
|
53
|
+
|
48
54
|
post_install_message:
|
49
55
|
rdoc_options: []
|
50
|
-
|
56
|
+
|
57
|
+
require_paths:
|
51
58
|
- lib
|
52
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
60
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
69
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
64
77
|
requirements: []
|
78
|
+
|
65
79
|
rubyforge_project:
|
66
80
|
rubygems_version: 1.8.19
|
67
81
|
signing_key:
|
68
82
|
specification_version: 3
|
69
83
|
summary: Photoshop soft light blending mode in SassScript
|
70
84
|
test_files: []
|
85
|
+
|