sassy-buttons 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.mkdn ADDED
@@ -0,0 +1,122 @@
1
+ Compass CSS Sassy Buttons
2
+ ====================
3
+
4
+ Super sassy and super easy CSS3 buttons.
5
+
6
+ Installation
7
+ ============
8
+
9
+ Install gem from the command line:
10
+
11
+ sudo gem install sassy-buttons
12
+
13
+ Create a new project using Sassy Buttons
14
+
15
+ compass create project_name -r sassy-buttons --using sassy-buttons
16
+
17
+ #import sassy buttons into your sass/scss file
18
+ @import "sassybuttons"
19
+
20
+
21
+ Adding Sassy Buttons to an exiting project:
22
+
23
+ # Edit the project configuration file and add:
24
+ require 'sassy-buttons'
25
+
26
+ # From the command line:
27
+ compass install sassy-buttons
28
+
29
+ #import sassy buttons into your sass/scss file
30
+ @import "sassybuttons"
31
+
32
+
33
+ Using Sassy Buttons
34
+ ===================
35
+
36
+ The Sassy Button mixin
37
+
38
+ # The simplest form of the mixin using the provided defaults (See Defaults section below)
39
+ @include sassy-button
40
+
41
+ # The Sassy Button mixin takes optional arguments that you can use to customise your buttons on the fly
42
+ # This will create a button with a blue matte stlye gradient, with a 15px border radius, 20px font size
43
+ @include sassy-button("matte", 15px, 20px, rgba(11, 153, 194, 1))
44
+
45
+ # The complete Sassy Button mixin syntax
46
+ @include sassy-button(gradient style, border radius, font size, first color, second color, text color, text style, auto hover)
47
+
48
+
49
+ Sassy Buttons Gradient Styles
50
+ ----------------------------
51
+ Sassy buttons offer five gradient styles for your buttons. These gradients are generated for you base on the colors you provide. If you don't provide a second color, the mixin will create one for you.
52
+
53
+ * Simple - A straight gradient from first color to the second color.
54
+ * Matte - A gradient that adds depth but remains a more matte finish.
55
+ * Shiny - A gradient that has a larger highlight area that gives a shinier look.
56
+ * Glass - A gradient thats provides a glass type finish
57
+ * Flat - No gradient, button will be given first color provided.
58
+
59
+ Sassy Buttons Text Styles
60
+ -------------------------
61
+ Sassy buttons has three text styles
62
+
63
+ * Inset - Text shadow that makes text look inset on the button
64
+ * Raised - Text shadow that makes text look raised on the button
65
+ * False - no text style
66
+
67
+ Sassy Buttons Defaults
68
+ ----------------------
69
+
70
+ The Sassy Buttons extension provides a set of defaults sass variables that are used in the various mixins to create the buttons. These defaults can be overridden to customize your buttons to your liking and has the added benefit of having to provide less arguments when calling the sassy button mixin.
71
+
72
+ # Available defaults
73
+ $sb-base-color: rgba(11,153,194,1) // Base color of button, used to caluclate graident styles.
74
+ $sb-second-color: false // Optional secondary color for gradient.
75
+ $sb-border-radius: 10px // Border radius of button.
76
+ $sb-border-width: 1px // Border width.
77
+ $sb-padding: .5em 1.5em // Padding that gives button structure.
78
+ $sb-font-size: 16px // Font size.
79
+ $sb-line-height: 1.2em // Line Height.
80
+ $sb-text-color: #fff // Button font color.
81
+ $sb-text-style: "inset" // Style of button text, can be "inset" or "raised" or false.
82
+ $sb-gradient-style: "matte" // Gradient style of button, can be "matte", "shiny", "glass", "simple", "flat".
83
+ $sb-hover: true // Automatically generate psuedo :hover state styles.
84
+
85
+ # Sassy Button structure mixin that gets called everytime you create a sassy button.
86
+ # You can add any custom styles you want applied to all your buttons.
87
+ @mixin sassy-button-default-structure
88
+ :display inline-block
89
+ :width auto
90
+ :height auto
91
+ :cursor pointer
92
+
93
+ Additional Sassy Button Styles
94
+ ------------------------------
95
+
96
+ Sassy Buttons provides two mixins that can add a little extra style to your buttons
97
+
98
+ # Mixin for adding styles to buttons
99
+ @include sassy-button-style(style, color)
100
+
101
+ Available styles:
102
+
103
+ * Inset - box shadow that gives button an inset look.
104
+ * Push - box shadow that gives button a "pushable" look.
105
+
106
+
107
+ Available Sassy Buttons Mixins
108
+ ------------------------------
109
+
110
+ Sassy buttons are made up a few different mixins, which all get called by the main sassy button mixin (@include sassy-button), these are all available for you to use to have more control over your buttons.
111
+
112
+ # Mixin for the structure of your button (this mixin calls the sassy-button-default structure mixin).
113
+ # Example use: Creating a custom button structure to apply color and text style mixins on.
114
+ @include sassy-button-structure(border radius, border width, padding, font size, line height)
115
+
116
+ # Mixin for the gradient styles
117
+ # Example use: You could call this mixin on a :hover or :active state to provide your own styles for those pseudo states.
118
+ @include sassy-button-colors(gradient style, first color, second color, auto hover)
119
+
120
+ # Mixin for text styles
121
+ # Example use: Apply a "inset", "raised" text style to a button
122
+ @include sassy-button-text-style(first color, text color, text style )
@@ -0,0 +1,3 @@
1
+ require 'compass'
2
+ extension_path = File.expand_path(File.join(File.dirname(__FILE__), ".."))
3
+ Compass::Frameworks.register('sassy-buttons', :path => extension_path)
@@ -0,0 +1,59 @@
1
+ // Sassy Buttons
2
+ // Compass extension by Jared Hardy - http://www.jaredhardy.com
3
+
4
+ @import "compass/css3/border-radius"
5
+ @import "compass/css3/box-shadow"
6
+ @import "compass/css3/text-shadow"
7
+ @import "compass/css3/gradient"
8
+
9
+ @import "sassy-buttons/sassy-button-colors"
10
+ @import "sassy-buttons/sassy-button-styles"
11
+ @import "sassy-buttons/sassy-button-text"
12
+ @import "sassy-buttons/sassy-button-pseudo-states"
13
+
14
+
15
+ // Sassy Button defaults
16
+ // These are the base defaults for the buttons, if you are going to use similar buttons on an entire site changing these
17
+ // can save you some time by calling the sassy button mixin with less arguments.
18
+
19
+ $sb-base-color: rgba(11,153,194,1) // Base color of button.
20
+ $sb-second-color: false // Optional secondary color for gradient.
21
+ $sb-border-radius: 10px // Border radius of button.
22
+ $sb-border-width: 1px // Border width.
23
+ $sb-padding: .5em 1.5em // Padding that gives button structure.
24
+ $sb-font-size: 16px // Font size.
25
+ $sb-line-height: 1.2em // Line Height.
26
+ $sb-text-color: #fff // Button font color.
27
+ $sb-text-style: "inset" // Style of button text, can be "inset" or "raised" or false.
28
+ $sb-gradient-style: "matte" // Gradient style of button, can be "matte", "shiny", or "glass".
29
+ $sb-hover: true // Automatically generate psuedo :hover state styles.
30
+ $sb-ieSupport: false // TODO - Better IE support
31
+
32
+ // Mixing that gets included when calling the sassy-button-structure if you need any
33
+ // styles applied to all your sassy buttons, add it here.
34
+ @mixin sassy-button-default-structure
35
+ :display inline-block
36
+ :width auto
37
+ :height auto
38
+ :cursor pointer
39
+ // IE support that will be coming soon
40
+ //@if($sb-ieSupport)
41
+ //:background-image image-url(ie-gradient.png)
42
+ //:background-repeat repeat-x
43
+
44
+ // The Sassy Button kitchen sink.
45
+ @mixin sassy-button($gradient-style: $sb-gradient-style, $border-radius: $sb-border-radius, $font-size: $sb-font-size, $first-color: $sb-base-color, $second-color: $sb-second-color, $text-color:$sb-text-color, $text-style: $sb-text-style, $auto-hover: $sb-hover)
46
+ @include sassy-button-structure($border-radius, $sb-border-width, $sb-padding, $font-size, $sb-line-height)
47
+ @include sassy-button-colors($gradient-style, $first-color, $second-color, $auto-hover)
48
+ @include sassy-button-text-style($first-color, $text-color, $text-style )
49
+
50
+ // Structure for a sassy button
51
+ @mixin sassy-button-structure($border-radius: $sb-border-radius, $border-width: $sb-border-width, $padding: $sb-padding, $font-size: $sb-font-size, $line-height: $sb-line-height)
52
+ @include sassy-button-default-structure
53
+ :font-size $font-size
54
+ :padding $padding
55
+ :line-height $line-height
56
+ :border-style solid
57
+ :border-width $border-width
58
+ @include border-radius($border-radius)
59
+
@@ -0,0 +1,71 @@
1
+ // Mixin that does all the gradient magic
2
+
3
+ @mixin sassy-button-colors($style: "matte", $base-color: $sb-base-color, $second-color: "false", $auto-states: true)
4
+
5
+ $lightness : lightness($base-color)
6
+ $brightnessDivsor : 1
7
+ @if $lightness > 75
8
+ $brightnessDivsor : 2
9
+
10
+ background-color: $base-color
11
+
12
+
13
+ @if $style == "matte"
14
+ $highlight: lighten($base-color, 30%)
15
+ $first-color: $base-color
16
+
17
+ @if $second-color == false
18
+ $first-color: lighten($base-color,15%)
19
+ $second-color: $base-color
20
+
21
+ @include linear-gradient(color-stops($highlight, $first-color 3%, $second-color 70%))
22
+
23
+ :border-color $second-color
24
+ @if $auto-states
25
+ @include sassy-pseudo-states("all", $first-color, $second-color, $highlight, $style)
26
+
27
+
28
+ @if $style == "shiny"
29
+ $highlight : lighten($base-color, 55%)
30
+ $first-color: lighten($base-color, 25% / $brightnessDivsor)
31
+
32
+ @if $second-color == false
33
+ $second-color: darken($base-color, 10%)
34
+
35
+ @include linear-gradient(color-stops($highlight,$first-color 3%, $base-color 50%, $second-color))
36
+
37
+ :border-color $second-color
38
+
39
+ @if $auto-states
40
+ @include sassy-pseudo-states("all", $first-color, $second-color, $highlight, $style)
41
+
42
+ @if $style == "glass"
43
+ $highlight : lighten($base-color, 55%)
44
+ $shine: lighten($base-color,10%)
45
+ $first-color: lighten($base-color, 8% / $brightnessDivsor)
46
+
47
+ @if $second-color == false
48
+ $second-color: darken($base-color, 10%)
49
+
50
+ @include linear-gradient(color-stops($highlight, $shine 2%, $first-color 50%, $base-color 51%, $second-color))
51
+ :border-color $second-color
52
+
53
+ @if $auto-states
54
+ @include sassy-pseudo-states("all", $first-color, $second-color, $highlight, $style)
55
+
56
+ @if $style == "simple"
57
+ @if $second-color == false
58
+ $second-color: darken($base-color, 20%)
59
+
60
+ @include linear-gradient(color-stops($base-color, $second-color))
61
+ :border-color $second-color
62
+
63
+ @if $auto-states
64
+ @include sassy-pseudo-states("all", $base-color, $second-color, false, $style)
65
+
66
+ @if $style == "flat"
67
+ :background-color $base-color
68
+
69
+ @if $auto-states
70
+ @include sassy-pseudo-states("all", $base-color, false, false, $style)
71
+
@@ -0,0 +1,41 @@
1
+ // Mixin that generates :hover state, will eventually add other psuedo states.
2
+
3
+ @mixin sassy-pseudo-states($states, $first-color, $second-color, $highlight, $style)
4
+ @if $states == "all"
5
+ @include sassy-button-hover($first-color, $second-color, $highlight, $style)
6
+
7
+
8
+ @mixin sassy-button-hover($first-color, $second-color, $highlight, $style)
9
+
10
+ @if $style == "matte"
11
+ &:hover
12
+ @include sb-ie-hover($first-color)
13
+ @include linear-gradient(color-stops($highlight, lighten($first-color, 5%) 3%, lighten($second-color, 5%) 75%))
14
+ @if $style == "shiny"
15
+ &:hover
16
+ @include sb-ie-hover($first-color)
17
+ @include linear-gradient(color-stops($highlight, lighten($first-color, 4%) 3%, lighten($second-color, 8%) 60%, lighten($second-color, 4%)))
18
+ @if $style == "glass"
19
+ &:hover
20
+ @include sb-ie-hover($first-color)
21
+ @include linear-gradient(color-stops($highlight, lighten($first-color, 15%) 2%, lighten($first-color, 10%) 50%, lighten($first-color, 3%) 51%, lighten($second-color, 10%)))
22
+ @if $style == "simple"
23
+ &:hover
24
+ @include sb-ie-hover($first-color)
25
+ @include linear-gradient(color-stops(lighten($first-color, 5%),lighten($second-color, 5%)))
26
+ @if $style == "flat"
27
+ &:hover
28
+ :background-color lighten($first-color, 5%)
29
+
30
+ // To do add other pseudo states
31
+
32
+
33
+ @mixin sb-ie-hover($color)
34
+ @if $sb-ieSupport
35
+ @if (lightness($color) > 75)
36
+ $color: darken($color, 15%)
37
+ :background-color $color
38
+
39
+
40
+
41
+
@@ -0,0 +1,13 @@
1
+ // Mixin for some optional styles on sassy buttons
2
+
3
+ @mixin sassy-button-style($style, $base-color: $sb-base-color)
4
+ @if $style == "push"
5
+ @include box-shadow(darken($base-color, 5%), 0, 0.4em, 0px)
6
+ :border-bottom solid 1px lighten($base-color, 3%)
7
+ &:active
8
+ :top .3em
9
+ @include box-shadow(darken($base-color, 8%), 0, 0.2em, 0px)
10
+ @if $style == "inset"
11
+ @include box-shadow(darken($base-color, 8%) 0 0.2em 0.4em inset)
12
+ :border solid 1px darken($base-color, 15%)
13
+
@@ -0,0 +1,15 @@
1
+ // Mixin that controls the text style
2
+ @mixin sassy-button-text-style($base-color, $text-color, $text-style: "inset")
3
+ $text-lightness: lightness($text-color)
4
+
5
+ :color $text-color
6
+ @if $text-style == "inset"
7
+ @if $text-lightness < 50
8
+ @include text-shadow(lighten($base-color, 20%), 0, 1px, 0)
9
+ @else
10
+ @include text-shadow(darken($base-color, 12%), 0, -1px, 0)
11
+ @if $text-style == "raised"
12
+ @if $text-lightness < 50
13
+ @include text-shadow(lighten($base-color, 20%), 0, -1px, 0)
14
+ @else
15
+ @include text-shadow(darken($base-color, 12%), 0, 1px, 0)
@@ -0,0 +1,28 @@
1
+ @import "sassy-buttons"
2
+
3
+
4
+ // Sassy Button defaults
5
+ // These are the base defaults for the buttons, if you are going to use similar buttons on an entire site,
6
+ // overriding these can save you some time by calling the sassy button mixin with less arguments.
7
+
8
+ $sb-base-color: rgba(11,153,194,1) // Base color of button.
9
+ $sb-second-color: false // Optional secondary color for gradient.
10
+ $sb-border-radius: 10px // Border radius of button.
11
+ $sb-border-width: 1px // Border width.
12
+ $sb-padding: .5em 1.5em // Padding that gives button structure.
13
+ $sb-font-size: 16px // Font size.
14
+ $sb-line-height: 1.2em // Line Height.
15
+ $sb-text-color: #fff // Button font color.
16
+ $sb-text-style: "inset" // Style of button text, can be "inset" or "raised" or false.
17
+ $sb-gradient-style: "matte" // Gradient style of button, can be "matte", "shiny", or "glass".
18
+ $sb-hover: true // Automatically generate psuedo :hover state styles.
19
+ $sb-ieSupport: false // TODO - Better IE support
20
+
21
+ // Mixing that gets included when calling the sassy-button-structure if you need any
22
+ // styles applied to all your sassy buttons, you can add them here.
23
+ @mixin sassy-button-default-structure
24
+ :background $sb-base-color
25
+ :display inline-block
26
+ :width auto
27
+ :height auto
28
+ :cursor pointer
@@ -0,0 +1,16 @@
1
+ # Make sure you list all the project template files here in the manifest.
2
+ stylesheet '_sassybuttons.sass', :media => 'screen, projection'
3
+
4
+ description "Sassy Buttons"
5
+
6
+ help %Q{
7
+
8
+ Documentation coming shortly
9
+
10
+ }
11
+
12
+ welcome_message %Q{
13
+
14
+ Sassy Buttons
15
+
16
+ }
metadata ADDED
@@ -0,0 +1,87 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sassy-buttons
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Jared Hardy
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-02-03 00:00:00 -08:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: compass
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ - 10
31
+ - 0
32
+ - rc3
33
+ version: 0.10.0.rc3
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: css only buttons extension for compass
37
+ email: jared@jaredhardy.com
38
+ executables: []
39
+
40
+ extensions: []
41
+
42
+ extra_rdoc_files: []
43
+
44
+ files:
45
+ - README.mkdn
46
+ - lib/sassy-buttons.rb
47
+ - stylesheets/_sassy-buttons.sass
48
+ - stylesheets/sassy-buttons/_sassy-button-colors.sass
49
+ - stylesheets/sassy-buttons/_sassy-button-pseudo-states.sass
50
+ - stylesheets/sassy-buttons/_sassy-button-styles.sass
51
+ - stylesheets/sassy-buttons/_sassy-button-text.sass
52
+ - templates/project/_sassybuttons.sass
53
+ - templates/project/manifest.rb
54
+ has_rdoc: true
55
+ homepage: http://www.jaredhardy.com
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ segments:
69
+ - 0
70
+ version: "0"
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ segments:
77
+ - 0
78
+ version: "0"
79
+ requirements: []
80
+
81
+ rubyforge_project:
82
+ rubygems_version: 1.3.7
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: css only buttons extension for compass
86
+ test_files: []
87
+