harsh 0.0.1
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 +2 -0
 - data/lib/harsh.rb +13 -0
 - data/stylesheets/_harsh.sass +52 -0
 - metadata +65 -0
 
    
        data/README.md
    ADDED
    
    
    
        data/lib/harsh.rb
    ADDED
    
    | 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'compass'
         
     | 
| 
      
 2 
     | 
    
         
            +
            extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
         
     | 
| 
      
 3 
     | 
    
         
            +
            Compass::Frameworks.register('harsh', :path => extension_path)
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module Sass::Script::Functions
         
     | 
| 
      
 6 
     | 
    
         
            +
              def random(type = Sass::Script::String.new("number"), max = Sass::Script::Number.new(100)) ## https://gist.github.com/1561650 Chris E.
         
     | 
| 
      
 7 
     | 
    
         
            +
                if type.value == "color"
         
     | 
| 
      
 8 
     | 
    
         
            +
                  Sass::Script::Color.new(:red => rand(255), :green => rand(255), :blue => rand(255))
         
     | 
| 
      
 9 
     | 
    
         
            +
                else
         
     | 
| 
      
 10 
     | 
    
         
            +
                  Sass::Script::Number.new(rand(max.value), max.numerator_units, max.denominator_units)
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
              end
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,52 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            @import compass
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            =harsh($color: random, $background: white, $transparency: .5, $number-of-gradients: 10, $angle: random, $nuance: true, $nuance-strength: 10) 
         
     | 
| 
      
 4 
     | 
    
         
            +
              +background(gradient-combiner($color, $background, $transparency, $number-of-gradients, $angle, $nuance, $nuance-strength))
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            =harsh-text($color: random, $transparency: .5, $number-of-gradients: 10, $angle: random, $nuance: true, $nuance-strength: 10, $background: false) 
         
     | 
| 
      
 7 
     | 
    
         
            +
              +background-image(gradient-combiner($color, $background, $transparency, $number-of-gradients, $angle, $nuance, $nuance-strength))
         
     | 
| 
      
 8 
     | 
    
         
            +
              -webkit-background-clip: text
         
     | 
| 
      
 9 
     | 
    
         
            +
              -webkit-text-fill-color: transparent
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            @function gradient-combiner($color, $background, $transparency, $number-of-gradients, $angle, $nuance, $nuance-strength)
         
     | 
| 
      
 12 
     | 
    
         
            +
              $all: ()
         
     | 
| 
      
 13 
     | 
    
         
            +
              @if type-of($color) == list
         
     | 
| 
      
 14 
     | 
    
         
            +
                @each $grad-color in $color
         
     | 
| 
      
 15 
     | 
    
         
            +
                  $all: append($all, gradient-builder($grad-color, $transparency, $angle, $nuance, $nuance-strength), comma)
         
     | 
| 
      
 16 
     | 
    
         
            +
              @else
         
     | 
| 
      
 17 
     | 
    
         
            +
                @for $i from 1 through $number-of-gradients
         
     | 
| 
      
 18 
     | 
    
         
            +
                  $all: append($all, gradient-builder($color, $transparency, $angle, $nuance, $nuance-strength), comma)
         
     | 
| 
      
 19 
     | 
    
         
            +
              @if $background != false 
         
     | 
| 
      
 20 
     | 
    
         
            +
                $all: append($all, $background, comma)
         
     | 
| 
      
 21 
     | 
    
         
            +
              @return $all
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            @function gradient-builder($color, $transparency, $angle, $nuance, $nuance-strength)  
         
     | 
| 
      
 24 
     | 
    
         
            +
              $base-color: base-finder($color, $nuance, $nuance-strength)
         
     | 
| 
      
 25 
     | 
    
         
            +
              $transparent-color: fade-out($base-color, $transparency)
         
     | 
| 
      
 26 
     | 
    
         
            +
              $colorstop: random()*1%
         
     | 
| 
      
 27 
     | 
    
         
            +
              $gradient: linear-gradient(angle-finder($angle), $transparent-color $colorstop, transparent $colorstop+.000001) //.001 to fix Compass bug/error where second color stop isn't larger than first
         
     | 
| 
      
 28 
     | 
    
         
            +
              @return $gradient
         
     | 
| 
      
 29 
     | 
    
         
            +
             
         
     | 
| 
      
 30 
     | 
    
         
            +
            @function base-finder($color, $nuance, $nuance-strength)
         
     | 
| 
      
 31 
     | 
    
         
            +
              @if $color == random
         
     | 
| 
      
 32 
     | 
    
         
            +
                @return random(color)
         
     | 
| 
      
 33 
     | 
    
         
            +
              @else if type-of($color) == color
         
     | 
| 
      
 34 
     | 
    
         
            +
                @if $nuance
         
     | 
| 
      
 35 
     | 
    
         
            +
                  @return nuance($color, $nuance, $nuance-strength)
         
     | 
| 
      
 36 
     | 
    
         
            +
                @else
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @return $color
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            @function angle-finder($angle) //http://dev.w3.org/csswg/css3-images/#linear-gradients
         
     | 
| 
      
 40 
     | 
    
         
            +
              @if $angle == random
         
     | 
| 
      
 41 
     | 
    
         
            +
                @return  random()*1% random()*1%
         
     | 
| 
      
 42 
     | 
    
         
            +
              @if $angle == random-fixed
         
     | 
| 
      
 43 
     | 
    
         
            +
                @return random()*1deg
         
     | 
| 
      
 44 
     | 
    
         
            +
              @else 
         
     | 
| 
      
 45 
     | 
    
         
            +
                @return $angle
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            @function nuance($color, $nuance, $nuance-strength)
         
     | 
| 
      
 48 
     | 
    
         
            +
              @if $nuance
         
     | 
| 
      
 49 
     | 
    
         
            +
                @return saturate(desaturate(lighten(darken($color, random(number, $nuance-strength)*1% ),random(number, $nuance-strength)*1%),random(number, $nuance-strength)*1%),random(number, $nuance-strength)*1%)
         
     | 
| 
      
 50 
     | 
    
         
            +
              @else
         
     | 
| 
      
 51 
     | 
    
         
            +
                @return $color
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: harsh
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
              prerelease: 
         
     | 
| 
      
 6 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 8 
     | 
    
         
            +
            - Casey Olson
         
     | 
| 
      
 9 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 10 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 11 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-10-29 00:00:00.000000000 Z
         
     | 
| 
      
 13 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 14 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 15 
     | 
    
         
            +
              name: compass
         
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 17 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 18 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 19 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 21 
     | 
    
         
            +
                    version: 0.10.0.rc3
         
     | 
| 
      
 22 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 23 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 25 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 26 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 27 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 28 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 29 
     | 
    
         
            +
                    version: 0.10.0.rc3
         
     | 
| 
      
 30 
     | 
    
         
            +
            description: Compass extension for randomly generated CSS3 gradients with harsh color
         
     | 
| 
      
 31 
     | 
    
         
            +
              stops
         
     | 
| 
      
 32 
     | 
    
         
            +
            email: casey.m.olson@gmail.com
         
     | 
| 
      
 33 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 34 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 35 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 36 
     | 
    
         
            +
            files:
         
     | 
| 
      
 37 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 38 
     | 
    
         
            +
            - lib/harsh.rb
         
     | 
| 
      
 39 
     | 
    
         
            +
            - stylesheets/_harsh.sass
         
     | 
| 
      
 40 
     | 
    
         
            +
            homepage: http://www.bookcasey.com/harsh/
         
     | 
| 
      
 41 
     | 
    
         
            +
            licenses: []
         
     | 
| 
      
 42 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 43 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 44 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 45 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 46 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 47 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 48 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 49 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 50 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 51 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 52 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 53 
     | 
    
         
            +
              none: false
         
     | 
| 
      
 54 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 55 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 56 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 57 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 58 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 59 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 60 
     | 
    
         
            +
            rubygems_version: 1.8.24
         
     | 
| 
      
 61 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 62 
     | 
    
         
            +
            specification_version: 3
         
     | 
| 
      
 63 
     | 
    
         
            +
            summary: Compass extension for randomly generated CSS3 gradients with harsh color
         
     | 
| 
      
 64 
     | 
    
         
            +
              stops
         
     | 
| 
      
 65 
     | 
    
         
            +
            test_files: []
         
     |