modular-scale 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,84 @@
1
+ # Sassy Modular Scale
2
+ #### Put down the calculator and let Sass do the work.
3
+
4
+ # Usage and Installation
5
+
6
+ Sassy Modular Scale is written in Sass and requires Sass to be used. Visit [sass-lang.com](http://sass-lang.com) to learn more and install.
7
+
8
+ * Copy either `stylesheets/_modular-scale.sass` or `stylesheets/_modular-scale.scss` into your project
9
+ * Import the file into your Sass stylesheet to access the mixins and functions
10
+
11
+ Sassy Modular Scale can be used as a function, mixin or a mixin that generates a range of classes to `@extend`.
12
+
13
+ Examples using the Sass syntax:
14
+
15
+ // Use as a function. Fill in the multiple, base-size, and ratio
16
+ height: modular-scale(7, 14px, $golden)
17
+
18
+ // Use as a mixin. Fill in the property, multiple, base-size, and ratio
19
+ +modular-scale(line-height, 1, 14px, $golden)
20
+
21
+ // This method will generate a range of classes to `@extend`
22
+ +modular-scale-classes(6)
23
+
24
+ [role="main"]
25
+ h1
26
+ @extend .ms-2
27
+ h2
28
+ @extend .ms-1
29
+ h3
30
+ @extend .ms-0
31
+
32
+ Examples using the SCSS syntax:
33
+
34
+ // Use as a function. Fill in the multiple, base-size, and ratio
35
+ height: modular-scale(7, 14px, $golden);
36
+
37
+ // Use as a mixin. Fill in the property, multiple, base-size, and ratio
38
+ @include modular-scale(line-height, 1, 14px, $golden);
39
+
40
+ // This method will generate a range of classes to `@extend`
41
+ @ionclude modular-scale-classes(6);
42
+
43
+ [role="main"] {
44
+ h1 { @extend .ms-2; }
45
+ h2 { @extend .ms-1; }
46
+ h3 { @extend .ms-0; }
47
+ }
48
+
49
+ # Ratios
50
+
51
+ Below is a list of Ratios to choose from. By default, the variable `$ratio` is set to `$golden`.
52
+
53
+ * $golden: 1.618
54
+ * $octave: 2 / 1
55
+ * $major-seventh: 15 / 8
56
+ * $minor-seventh: 16 / 9
57
+ * $major-sixth: 5 / 3
58
+ * $minor-sixth: 8 / 5
59
+ * $fifth: 3 / 2
60
+ * $fourth: 4 / 3
61
+ * $major-third: 5 / 4
62
+ * $minor-third: 6 / 5
63
+ * $major-second: 9 / 8
64
+ * $minor-second: 16 / 15
65
+
66
+ # Credits
67
+
68
+ #### Sass mixin by Scott Kellum
69
+
70
+ * [https://github.com/scottkellum/modular-scale](https://github.com/scottkellum/modular-scale)
71
+ * [@scottkellum](http://twitter.com/scottkellum)
72
+
73
+ #### Adapted from modularscale.com by Tim Brown
74
+
75
+ * [http://modularscale.com/](http://modularscale.com/)
76
+ * [@nicewebtype](http://twitter.com/nicewebtype)
77
+
78
+ #### Related link:
79
+
80
+ * [http://alistapart.com/articles/more-meaningful-typography/](http://alistapart.com/articles/more-meaningful-typography/)
81
+
82
+ #### Additional credit to Robert Bringhurst
83
+
84
+ * The Elements of Typographic Style (Chapter 8: Shaping the page)
@@ -0,0 +1,9 @@
1
+ require 'compass'
2
+ Compass::Frameworks.register("modular-scale", :path => "#{File.dirname(__FILE__)}/..")
3
+
4
+ module ModularScale
5
+
6
+ VERSION = "0.0.1"
7
+ DATE = "2011-08-14"
8
+
9
+ end
@@ -0,0 +1,56 @@
1
+ // Ratios
2
+ $golden: 1.618
3
+ $octave: (2 / 1)
4
+ $major-seventh: (15 / 8)
5
+ $minor-seventh: (16 / 9)
6
+ $major-sixth: (5 / 3)
7
+ $minor-sixth: (8 / 5)
8
+ $fifth: (3 / 2)
9
+ $fourth: (4 / 3)
10
+ $major-third: (5 / 4)
11
+ $minor-third: (6 / 5)
12
+ $major-second: (9 / 8)
13
+ $minor-second: (16 / 15)
14
+
15
+ // Defaults
16
+ $ratio: $golden !default
17
+ $base-size: 12px !default
18
+ $property: font-size !default
19
+ $class-slug: ms !default
20
+
21
+ // Modular Scale function
22
+ @function modular-scale($multiple, $base-size, $ratio)
23
+
24
+ // On init, $modular-scale equals the default value of $base-size or the value passed to the function
25
+ $modular-scale: $base-size
26
+
27
+ // If $multiple is a positive integer (up the scale)
28
+ @if $multiple > 0
29
+ @for $i from 1 through $multiple
30
+ $modular-scale: $modular-scale * $ratio
31
+
32
+ // If $multiple is a negative integer (down the scale)
33
+ @if $multiple < 0
34
+ @for $i from 1 through ($multiple * -1)
35
+ $modular-scale: $modular-scale / $ratio
36
+
37
+ // Return the new or unchanged value of $modular-scale
38
+ @return $modular-scale
39
+
40
+ // Shortcut
41
+ @function ms($multiple, $base-size, $ratio)
42
+ // Return the value from the Modular Scale function
43
+ @return modular-scale($multiple, $base-size, $ratio)
44
+
45
+ // Mixin
46
+ =modular-scale($property, $multiple, $base-size, $ratio)
47
+ // Print the $property and return the value from the Modular Scale function
48
+ #{$property}: modular-scale($multiple, $base-size, $ratio)
49
+
50
+ // Classes Mixin
51
+ =modular-scale-classes($multiple, $property)
52
+
53
+ // Loop from 0 through the value of $multiple and generate a range of classes
54
+ @for $i from 0 through $multiple
55
+ .#{$class-slug}-#{$i}
56
+ +modular-scale($property, $i)
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: modular-scale
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.0.1
6
+ platform: ruby
7
+ authors:
8
+ - Scott Kellum
9
+ - Adam Stacoviak
10
+ - Mason Wendell
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2011-08-14 00:00:00 Z
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: compass
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.11.5
25
+ type: :runtime
26
+ prerelease: false
27
+ version_requirements: *id001
28
+ description: Modular Scale calculates the incremental values of the modular scale.
29
+ email:
30
+ - scott@treesaver.net
31
+ - adam@stacoviak.com
32
+ - mason@zivtech.com
33
+ executables: []
34
+
35
+ extensions: []
36
+
37
+ extra_rdoc_files: []
38
+
39
+ files:
40
+ - README.mdown
41
+ - lib/modular-scale.rb
42
+ - stylesheets/_modular-scale.sass
43
+ homepage: https://github.com/scottkellum/modular-scale
44
+ licenses: []
45
+
46
+ post_install_message:
47
+ rdoc_options: []
48
+
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ hash: -2151708732276106384
57
+ segments:
58
+ - 0
59
+ version: "0"
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.3.6
66
+ requirements: []
67
+
68
+ rubyforge_project:
69
+ rubygems_version: 1.8.7
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Modular Scale calculates the incremental values of the modular scale in proportion to a set size and ratio. Inspired by and adapted from Tim Brown's modularscale.com.
73
+ test_files: []
74
+