simple-button-generator 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.
- checksums.yaml +7 -0
- data/button/button-generator.scss +78 -0
- data/functions/_linear-gradient-colors.scss +25 -0
- data/functions/_responsive-size.scss +15 -0
- data/mixins/_decoration-mixins.scss +101 -0
- data/mixins/_helper-mixins.scss +40 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 202921d85474f217a4135a6f7226130b1c8a4857
|
4
|
+
data.tar.gz: e144509c4d7a21ec3dbf136be4883e82dcebe50b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cfb266ae4bcc50127f0bc00f5b2156278297540d7f5eeabdeb5c744bd919a2f9c582387300a8c33bfb3b8768309d0a77c9b97d4242c8ba36ebef85831d10e601
|
7
|
+
data.tar.gz: 1145ae2f4b6bf8d28d9562129aba14a34e4d4aa37646109e474bdbf2ea36213dec4f067c88b45d2069fc47a8eda495220600d46f898c37e6ee9e56c7eedaeffe
|
@@ -0,0 +1,78 @@
|
|
1
|
+
/* ==|== button classes ========================================
|
2
|
+
Classes to style buttons
|
3
|
+
================================================================ */
|
4
|
+
@import "../mixins/helper-mixins"
|
5
|
+
, "../mixins/decoration-mixins"
|
6
|
+
, "../functions/linear-gradient-colors"
|
7
|
+
, "../functions/responsive-size";
|
8
|
+
|
9
|
+
// Button Variables
|
10
|
+
$blue: #002868 !default;
|
11
|
+
$lightened-blue: lighten($blue, 15%) !default;
|
12
|
+
$white: darken(#fff, 4%) !default;
|
13
|
+
$button-default-bg-color: $lightened-blue, $blue !default;
|
14
|
+
$button-default-font-color: $white !default;
|
15
|
+
$button-default-border-positions: top, right, bottom, left;
|
16
|
+
$button-default-border-colors: desaturate(lighten($blue, 21%), 37%), lighten($blue, 10%), lighten($blue, 10%), desaturate(lighten($blue, 21%), 37%);
|
17
|
+
|
18
|
+
%button-props {
|
19
|
+
width: auto;
|
20
|
+
min-width: 100px;
|
21
|
+
height: 30px;
|
22
|
+
@include opacity(100);
|
23
|
+
text-align: center;
|
24
|
+
font-size: 1.0em;
|
25
|
+
line-height: rs(16px);
|
26
|
+
margin: 10px;
|
27
|
+
display: inline-block;
|
28
|
+
position: relative;
|
29
|
+
@include add-border-radius($border-radius: 5px);
|
30
|
+
}
|
31
|
+
|
32
|
+
@mixin generateButton($bg-color: $button-default-bg-color,
|
33
|
+
$font-color: $button-default-font-color,
|
34
|
+
$border-colors: $button-default-border-colors,
|
35
|
+
$disabled-opacity: 40) {
|
36
|
+
//determine the dominant color of the button, this is needed for the determination of the font color
|
37
|
+
$button-major-color: $bg-color;
|
38
|
+
//if the background color has more than one color, the colors are to be used to create a linear
|
39
|
+
//gradient
|
40
|
+
@if length($bg-color) > 1 {
|
41
|
+
@include linear-gradient(top, $bg-color);
|
42
|
+
&:hover {
|
43
|
+
$hover-bg-color: darken(nth($bg-color, 1), 15%), nth($bg-color, 2);
|
44
|
+
@include linear-gradient(top, $hover-bg-color);
|
45
|
+
}
|
46
|
+
&:active {
|
47
|
+
background-color: nth($bg-color, 2);
|
48
|
+
}
|
49
|
+
$button-major-color: nth($bg-color, 2);
|
50
|
+
} @else {
|
51
|
+
background-color: $bg-color;
|
52
|
+
}
|
53
|
+
|
54
|
+
//use the different border settings to set the colors
|
55
|
+
$idx: 1;
|
56
|
+
@if length($border-colors) > 1 {
|
57
|
+
@each $border-color in $border-colors {
|
58
|
+
@include add-border(nth($button-default-border-positions, $idx), 1px, solid, $border-color);
|
59
|
+
$idx: $idx + 1;
|
60
|
+
}
|
61
|
+
} @else {
|
62
|
+
@include add-border($border-color: $border-colors);
|
63
|
+
}
|
64
|
+
|
65
|
+
//calculate the lightness of the background color and set the font color
|
66
|
+
@if lightness($button-major-color) < 80% {
|
67
|
+
color: $font-color;
|
68
|
+
} @else {
|
69
|
+
color: invert($font-color);
|
70
|
+
}
|
71
|
+
|
72
|
+
@extend %button-props;
|
73
|
+
|
74
|
+
&.button-disabled {
|
75
|
+
@include opacity($disabled-opacity);
|
76
|
+
cursor: default;
|
77
|
+
}
|
78
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
// ==|===Linear gradient color processing====================
|
2
|
+
// Function that will process the given number of colors
|
3
|
+
// and return the correct color strings
|
4
|
+
// =========================================================*/
|
5
|
+
@function linearGradientColors($stop-colors...) {
|
6
|
+
$full: false;
|
7
|
+
@each $stop-color in $stop-colors{
|
8
|
+
@if $full {
|
9
|
+
$full: $full + ',' + $stop-color;
|
10
|
+
} @else {
|
11
|
+
$full: $stop-color;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
$full: unquote($full);
|
16
|
+
|
17
|
+
//If using COMPASS uncomment the line below and remove line 10 - 17
|
18
|
+
//$full: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
|
19
|
+
|
20
|
+
@return $full;
|
21
|
+
}
|
22
|
+
|
23
|
+
@function lgc($stop-colors...) {
|
24
|
+
@return linearGradientColors($stop-colors...);
|
25
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
// ==|=== Responsive Size calculator====================
|
2
|
+
// Function that will calculate the responsive size
|
3
|
+
// return the em value to be used.
|
4
|
+
// =========================================================
|
5
|
+
$default-browser-size: 16px !default;
|
6
|
+
|
7
|
+
@function responsive-size($fontSize: $default-browser-size) {
|
8
|
+
@return $fontSize/$default-browser-size * 1em;
|
9
|
+
}
|
10
|
+
|
11
|
+
|
12
|
+
@function rs($fontSize: $default-browser-size) {
|
13
|
+
@return responsive-size($fontSize);
|
14
|
+
}
|
15
|
+
// ==|=== End Responsive Size calculator====================
|
@@ -0,0 +1,101 @@
|
|
1
|
+
//==|== decoration mixin =====================================================
|
2
|
+
// For more information on mixins go here:
|
3
|
+
// http://sass-lang.com/#mixins
|
4
|
+
// or here:
|
5
|
+
// http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
|
6
|
+
// Author:
|
7
|
+
// ========================================================================== */
|
8
|
+
@import "../functions/linear-gradient-colors";
|
9
|
+
|
10
|
+
//This mixin will add border at given position. If no position is given (or position is all)
|
11
|
+
//then the border will be applied to all sides
|
12
|
+
@mixin add-border($border-position: all, $border-size: 1px, $border-pattern: solid, $border-color: #000) {
|
13
|
+
@if $border-position == 'all' {
|
14
|
+
border: $border-size $border-pattern $border-color;
|
15
|
+
} @else {
|
16
|
+
border-#{$border-position}: $border-size $border-pattern $border-color;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
//this mixin will set the border-radius for either all sides or a specified
|
21
|
+
//side
|
22
|
+
@mixin add-border-radius($border-radius-position: all, $border-radius: 2px) {
|
23
|
+
@if $border-radius-position == 'all' {
|
24
|
+
border-radius: $border-radius;
|
25
|
+
} @else {
|
26
|
+
border-#{$border-radius-position}-radius: $border-radius;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
//this mixin will create a linear-gradient. The parameters passed here are:
|
31
|
+
//$pos: position of the gradient which defaults to top but can take bottom, left, or right
|
32
|
+
//$stop-colors: these allow for any number of color stops values, color and length/percentage
|
33
|
+
@mixin linear-gradient($pos, $stop-colors...) {
|
34
|
+
|
35
|
+
// Detect what type of value exists in $pos
|
36
|
+
$pos-type: type-of(nth($pos, 1));
|
37
|
+
|
38
|
+
// If $pos is missing from mixin, reassign vars and add default position
|
39
|
+
@if ($pos-type == color) or (nth($pos, 1) == "transparent") {
|
40
|
+
$pos: top; // Default position
|
41
|
+
}
|
42
|
+
|
43
|
+
$pos: unquote($pos);
|
44
|
+
|
45
|
+
$full: lgc($stop-colors...);
|
46
|
+
|
47
|
+
// Set the first stop-color as the default fallback color
|
48
|
+
$fallback-color: nth(nth($stop-colors, 1), 1);
|
49
|
+
|
50
|
+
background: $fallback-color;
|
51
|
+
background: -webkit-linear-gradient($pos, $full); // Safari 5.1+, Chrome
|
52
|
+
background: -moz-linear-gradient($pos, $full);
|
53
|
+
background: -ms-linear-gradient($pos, $full);
|
54
|
+
background: -o-linear-gradient($full);
|
55
|
+
background: unquote("linear-gradient(#{$full})");
|
56
|
+
}
|
57
|
+
|
58
|
+
//this mixin will create background image attached to a linear gradient background
|
59
|
+
@mixin add-background-image-gradient($url, $position, $repeat, $gradient-pos, $stop-colors...){
|
60
|
+
$full: lgc($stop-colors...);
|
61
|
+
background: $url $position $repeat, nth(nth($stop-colors, 1), 1);
|
62
|
+
background: $url $position $repeat, -webkit-linear-gradient($gradient-pos, $full);
|
63
|
+
background: $url $position $repeat, -moz-linear-gradient($gradient-pos, $full);
|
64
|
+
background: $url $position $repeat, -ms-linear-gradient($gradient-pos, $full);
|
65
|
+
background: $url $position $repeat, -o-linear-gradient($full);
|
66
|
+
background: $url $position $repeat, unquote("linear-gradient(#{$full})");
|
67
|
+
}
|
68
|
+
|
69
|
+
//this mixin will set the box-shadow values. It will also allow for the felxibility of
|
70
|
+
//doing an inset shadow.
|
71
|
+
@mixin box-shadow ($isInset: false, $hOffset: 0, $vOffset: 0, $blur: 0, $spread: 0, $color: #ccc) {
|
72
|
+
@if $isInset {
|
73
|
+
-moz-box-shadow: inset $hOffset $vOffset $blur $spread $color;
|
74
|
+
-webkit-box-shadow: inset $hOffset $vOffset $blur $spread $color;
|
75
|
+
box-shadow: inset $hOffset $vOffset $blur $spread $color;
|
76
|
+
} @else {
|
77
|
+
-moz-box-shadow: $hOffset $vOffset $blur $spread $color;
|
78
|
+
-webkit-box-shadow: $hOffset $vOffset $blur $spread $color;
|
79
|
+
box-shadow: $hOffset $vOffset $blur $spread $color;
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
// Background clipping
|
84
|
+
// Heads up: FF 3.6 and under need "padding" instead of "padding-box"
|
85
|
+
@mixin background-clip($clip) {
|
86
|
+
-webkit-background-clip: $clip;
|
87
|
+
-moz-background-clip: $clip;
|
88
|
+
background-clip: $clip;
|
89
|
+
}
|
90
|
+
|
91
|
+
//A mixin that creates a text stroke
|
92
|
+
@mixin text-stroke ($stroke-width: 1px, $stroke-color: #000) {
|
93
|
+
-webkit-text-stroke: $stroke-width $stroke-color;
|
94
|
+
$negative-stroke-width: $stroke-width * -1;
|
95
|
+
text-shadow:
|
96
|
+
$negative-stroke-width $negative-stroke-width 0 #000,
|
97
|
+
$stroke-width $negative-stroke-width 0 #000,
|
98
|
+
$negative-stroke-width $stroke-width 0 #000,
|
99
|
+
$stroke-width $stroke-width 0 #000;
|
100
|
+
}
|
101
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
//==|== Helper mixin =====================================================
|
2
|
+
// For more information on mixins go here:
|
3
|
+
// http://sass-lang.com/#mixins
|
4
|
+
// or here:
|
5
|
+
// http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html#mixins
|
6
|
+
// Author:
|
7
|
+
// ========================================================================== */
|
8
|
+
|
9
|
+
//this mixin will set the list-style-type to none and remove any padding
|
10
|
+
@mixin no-list-style {
|
11
|
+
list-style-type: none;
|
12
|
+
list-style-image: none;
|
13
|
+
padding: 0;
|
14
|
+
margin: 0;
|
15
|
+
}
|
16
|
+
|
17
|
+
//this mixin will add the hand/pointer cursor to any element that
|
18
|
+
//will be treated as a link/clickable
|
19
|
+
@mixin hand-cursor {
|
20
|
+
cursor: hand;
|
21
|
+
cursor: pointer;
|
22
|
+
}
|
23
|
+
|
24
|
+
// FORMS
|
25
|
+
// --------------------------------------------------
|
26
|
+
|
27
|
+
// Block level inputs
|
28
|
+
@mixin input-block-level {
|
29
|
+
display: block;
|
30
|
+
width: 100%;
|
31
|
+
min-height: $inputHeight; // Make inputs at least the height of their button counterpart (base line-height + padding + border)
|
32
|
+
@include box-sizing(border-box); // Makes inputs behave like true block-level elements
|
33
|
+
}
|
34
|
+
|
35
|
+
// Opacity
|
36
|
+
@mixin opacity($opacity) {
|
37
|
+
opacity: $opacity / 100;
|
38
|
+
filter: alpha(opacity=$opacity);
|
39
|
+
}
|
40
|
+
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple-button-generator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kianosh Pourian
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: sass
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.3.0.rc.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.3.0.rc.2
|
27
|
+
description: This gem was created for a presentation around Sass
|
28
|
+
email: kianoshp@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- button/button-generator.scss
|
34
|
+
- functions/_linear-gradient-colors.scss
|
35
|
+
- functions/_responsive-size.scss
|
36
|
+
- mixins/_decoration-mixins.scss
|
37
|
+
- mixins/_helper-mixins.scss
|
38
|
+
homepage: http://rubygems.org/gems/simple-button-generator
|
39
|
+
licenses:
|
40
|
+
- MIT
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 2.0.3
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: A simple button generator
|
62
|
+
test_files: []
|