Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…ree/5bdaa07c0fcfa6f1e3507185fa805741eeb33952 before they deprecated the old webkit gradients syntax (Kickoff still needs it)
  • Loading branch information
mrmartineau committed Jul 7, 2013
1 parent b34893d commit cc5ba71
Show file tree
Hide file tree
Showing 34 changed files with 491 additions and 298 deletions.
2 changes: 1 addition & 1 deletion scss/_colour-palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ $info-background : #d9edf7;
$info-border : darken(adjust-hue($info-background, -10), 7%);

// <hr> border colour
$hrBorder : lighten(#000, 70%)er;
$hr-border : lighten(#000, 70%);
1 change: 1 addition & 0 deletions scss/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ img {
&.left {
margin:0 20px 0 0;
}

&.right {
margin:0 0 0 20px;
}
Expand Down
2 changes: 1 addition & 1 deletion scss/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ textarea {
text-align: center;
text-shadow: 0 1px 0 #fff;
vertical-align: middle;
background-color: lighten(#000, 70%)er;
background-color: lighten(#000, 70%);
border: 1px solid #ccc;
}
& .add-on,
Expand Down
3 changes: 1 addition & 2 deletions scss/_functions.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
@import "functions/compact";
@import "functions/deprecated-webkit-gradient";
@import "functions/golden-ratio";
@import "functions/linear-gradient";
@import "functions/modular-scale";
@import "functions/px-to-em";
@import "functions/radial-gradient";
@import "functions/render-gradients";
@import "functions/tint-shade";
@import "functions/transition-property-name";
8 changes: 8 additions & 0 deletions scss/_helpers.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Custom Helpers
@import "helpers/deprecated-webkit-gradient";
@import "helpers/gradient-positions-parser";
@import "helpers/linear-positions-parser";
@import "helpers/radial-arg-parser";
@import "helpers/radial-positions-parser";
@import "helpers/render-gradients";
@import "helpers/shape-size-stripper";
5 changes: 4 additions & 1 deletion scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// * RESPONSIVE
// * CSS3
// * UTILITY MIXINS
// * HiDPI
// * FORMS

// === Vendor prefix ===
Expand All @@ -23,10 +24,12 @@
// === COMPONENTS ===
@import "mixins/buttons";


// === UTILITY MIXINS ===
@import "mixins/utility";

// === HiDPI ===
@import "mixins/hidpi";

// === FORMS ===
@import "mixins/forms";

Expand Down
2 changes: 1 addition & 1 deletion scss/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ dd {
hr {
margin: ($base-line-height + px) 0;
border: 0;
border-top: 1px solid $hrBorder;
border-top: 1px solid $hr-border;
border-bottom: 1px solid #fff;
}

Expand Down
12 changes: 6 additions & 6 deletions scss/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@
.clear { clear:both; float:none; }

.mb0 { margin-bottom: 0 !important;}
.mb1 { margin-bottom: $base-font-size !important;}
.mb2 { margin-bottom: $base-font-size * 1.5 !important;}
.mb3 { margin-bottom: $base-font-size * 1.875 !important;}
.mb1 { margin-bottom: ($base-font-size) + px !important;}
.mb2 { margin-bottom: ($base-font-size * 1.5) + px !important;}
.mb3 { margin-bottom: ($base-font-size * 1.875) + px !important;}

.mt0 { margin-top: 0 !important;}
.mt1 { margin-top: $base-font-size !important;}
.mt2 { margin-top: $base-font-size * 1.5 !important;}
.mt3 { margin-top: $base-font-size * 1.875 !important;}
.mt1 { margin-top: ($base-font-size) + px !important;}
.mt2 { margin-top: ($base-font-size * 1.5) + px !important;}
.mt3 { margin-top: ($base-font-size * 1.875) + px !important;}
Empty file modified scss/functions/_compact.scss
100644 → 100755
Empty file.
44 changes: 0 additions & 44 deletions scss/functions/_deprecated-webkit-gradient.scss

This file was deleted.

3 changes: 3 additions & 0 deletions scss/functions/_golden-ratio.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@function golden-ratio($value, $increment) {
@return modular-scale($value, $increment, $golden)
}
15 changes: 11 additions & 4 deletions scss/functions/_linear-gradient.scss
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
@function linear-gradient($gradients...) {
$type: linear;
$type-gradient: append($type, $gradients, comma);
@function linear-gradient($pos, $gradients...) {
$type: linear;
$pos-type: type-of(nth($pos, 1));

@return $type-gradient;
// if $pos doesn't exist, fix $gradient
@if ($pos-type == color) or (nth($pos, 1) == "transparent") {
$gradients: zip($pos $gradients);
$pos: false;
}

$type-gradient: $type, $pos, $gradients;
@return $type-gradient;
}
82 changes: 54 additions & 28 deletions scss/functions/_modular-scale.scss
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,40 +1,66 @@
// Scaling Varaibles
$golden: 1.618;
$minor-second: 1.067;
$major-second: 1.125;
$minor-third: 1.2;
$major-third: 1.25;
$perfect-fourth: 1.333;
$augmented-fourth: 1.414;
$perfect-fifth: 1.5;
$minor-sixth: 1.6;
$major-sixth: 1.667;
$minor-seventh: 1.778;
$major-seventh: 1.875;
$octave: 2;
$major-tenth: 2.5;
$major-eleventh: 2.667;
$major-twelfth: 3;
$double-octave: 4;

@function modular-scale($value, $increment, $ratio) {
$v1: nth($value, 1);
$v2: nth($value, length($value));
$value: $v1;

// scale $v2 to just above $v1
@while $v2 > $v1 {
$v2: ($v2 / $ratio); // will be off-by-1
}
@while $v2 < $v1 {
$v2: ($v2 * $ratio); // will fix off-by-1
}

// check AFTER scaling $v2 to prevent double-counting corner-case
$double-stranded: $v2 > $v1;

@if $increment > 0 {
@for $i from 1 through $increment {
$value: ($value * $ratio);
@if $double-stranded and ($v1 * $ratio) > $v2 {
$value: $v2;
$v2: ($v2 * $ratio);
} @else {
$v1: ($v1 * $ratio);
$value: $v1;
}
}
}

@if $increment < 0 {
$increment: abs($increment);
@for $i from 1 through $increment {
$value: ($value / $ratio);
// adjust $v2 to just below $v1
@if $double-stranded {
$v2: ($v2 / $ratio);
}

@for $i from $increment through -1 {
@if $double-stranded and ($v1 / $ratio) < $v2 {
$value: $v2;
$v2: ($v2 / $ratio);
} @else {
$v1: ($v1 / $ratio);
$value: $v1;
}
}
}

@return $value;
}

// div {
// Increment Up GR with positive value
// font-size: modular-scale(14px, 1, 1.618); // returns: 22.652px
//
// Increment Down GR with negative value
// font-size: modular-scale(14px, -1, 1.618); // returns: 8.653px
//
// Can be used with ceil(round up) or floor(round down)
// font-size: floor( modular-scale(14px, 1, 1.618) ); // returns: 22px
// font-size: ceil( modular-scale(14px, 1, 1.618) ); // returns: 23px
// }
//
// modularscale.com

@function golden-ratio($value, $increment) {
@return modular-scale($value, $increment, 1.618)
}

// div {
// font-size: golden-ratio(14px, 1); // returns: 22.652px
// }
//
// goldenratiocalculator.com
2 changes: 1 addition & 1 deletion scss/functions/_px-to-em.scss
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
// if the parent is another value say 24px write em(12, 24)

@function em($pxval, $base: 16) {
@return ($pxval / $base) * 1em;
@return ($pxval / $base) * 1em;
}

56 changes: 11 additions & 45 deletions scss/functions/_radial-gradient.scss
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,54 +4,20 @@
$G5: false, $G6: false,
$G7: false, $G8: false,
$G9: false, $G10: false,
$pos: 50% 50%,
$shape-size: ellipse cover) {
$pos: null,
$shape-size: null) {

@each $value in $G1, $G2 {
$first-val: nth($value, 1);
$pos-type: type-of($first-val);

@if ($pos-type != color) or ($first-val != "transparent") {
@if ($pos-type == number)
or ($first-val == "center")
or ($first-val == "top")
or ($first-val == "right")
or ($first-val == "bottom")
or ($first-val == "left") {

$pos: $value;

@if $pos == $G1 {
$G1: false;
}
}

@else if
($first-val == "ellipse")
or ($first-val == "circle")
or ($first-val == "closest-side")
or ($first-val == "closest-corner")
or ($first-val == "farthest-side")
or ($first-val == "farthest-corner")
or ($first-val == "contain")
or ($first-val == "cover") {

$shape-size: $value;

@if $value == $G1 {
$G1: false;
}

@else if $value == $G2 {
$G2: false;
}
}
}
}
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
$G1: nth($data, 1);
$G2: nth($data, 2);
$pos: nth($data, 3);
$shape-size: nth($data, 4);

$type: radial;
$gradient: compact($pos, $shape-size, $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);
$type-gradient: append($type, $gradient, comma);
$gradient: compact($G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10);

$type-gradient: $type, $shape-size $pos, $gradient;
@return $type-gradient;
}


14 changes: 0 additions & 14 deletions scss/functions/_render-gradients.scss

This file was deleted.

4 changes: 2 additions & 2 deletions scss/functions/_tint-shade.scss
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
@return mix(white, $color, $percent);
}

// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
@return mix(black, $color, $percent);
}
Empty file modified scss/functions/_transition-property-name.scss
100644 → 100755
Empty file.
39 changes: 39 additions & 0 deletions scss/helpers/_deprecated-webkit-gradient.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Render Deprecated Webkit Gradient - Linear || Radial
//************************************************************************//
@function _deprecated-webkit-gradient($type,
$deprecated-pos1, $deprecated-pos2,
$full,
$deprecated-radius1: false, $deprecated-radius2: false) {
$gradient-list: ();
$gradient: false;
$full-length: length($full);
$percentage: false;
$gradient-type: $type;

@for $i from 1 through $full-length {
$gradient: nth($full, $i);

@if length($gradient) == 2 {
$color-stop: color-stop(nth($gradient, 2), nth($gradient, 1));
$gradient-list: join($gradient-list, $color-stop, comma);
}
@else if $gradient != null {
@if $i == $full-length {
$percentage: 100%;
}
@else {
$percentage: ($i - 1) * (100 / ($full-length - 1)) + "%";
}
$color-stop: color-stop(unquote($percentage), $gradient);
$gradient-list: join($gradient-list, $color-stop, comma);
}
}

@if $type == radial {
$gradient: -webkit-gradient(radial, $deprecated-pos1, $deprecated-radius1, $deprecated-pos2, $deprecated-radius2, $gradient-list);
}
@else if $type == linear {
$gradient: -webkit-gradient(linear, $deprecated-pos1, $deprecated-pos2, $gradient-list);
}
@return $gradient;
}
Loading

0 comments on commit cc5ba71

Please sign in to comment.