modular-scale 2.0.5 → 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8de48357a5e89e59a8190da7507025c2ff60b4d4
4
+ data.tar.gz: 180a64149b98ad4ede3c45d01616ebdfd897dc29
5
+ SHA512:
6
+ metadata.gz: a629dfc386e7506f998710fa04814ef96f800a055f91a8ea25dc5465bafd71c090796a9a030acb6629d0b11608f361d5d6d434e545a4d726a7b19aec86c91c65
7
+ data.tar.gz: aa492d829fc0bfbbd7e9a2ac9d8db3998d2c995363f3ccda3f54e3d410a0862b3e34fc81a963e4e80388aed1d1fb8c3ff23944b568f2989c28e9470468c1396b
data/changelog.md ADDED
@@ -0,0 +1,20 @@
1
+ # Version 2.0.6
2
+
3
+ Pixel rounding and responsive mixins
4
+
5
+ # Version 2.0.4
6
+
7
+ Version to the same release number as bower.
8
+
9
+ # Version 2.0.0
10
+
11
+ This is a breaking version. You will need to refactor slightly in order to upgrade to this version from a previous version.
12
+
13
+ * Complete re-write.
14
+ * ratios are variables, not functions
15
+ * Common variables are scoped to "ms-"
16
+ * ms-lists() is the list functions
17
+ * No more mixins at all, only functions.
18
+ * Increased compatibility with Sass 3.1 and up
19
+ * Compatibility with LibSass
20
+ * Compass no longer required (non-integer values require Compass)
data/lib/modular-scale.rb CHANGED
@@ -16,7 +16,7 @@ Compass::Frameworks.register('modular-scale', :path => extension_path)
16
16
  # a prerelease version
17
17
  # Date is in the form of YYYY-MM-DD
18
18
  module ModularScale
19
- VERSION = "2.0.5"
19
+ VERSION = "2.0.6"
20
20
  DATE = "2013-12-20"
21
21
  end
22
22
 
data/license.md CHANGED
@@ -1,36 +1,9 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013 Scott Kellum, Mason Wendell
3
+ Copyright © 2015 [Scott Kellum](http://www.scottkellum.com/) ([@scottkellum](http://twitter.com/scottkellum)), [Adam Stacoviak](http://adamstacoviak.com/) ([@adamstac](http://twitter.com/adamstac)) and [Mason Wendell](http://thecodingdesigner.com/) ([@codingdesigner](http://twitter.com/codingdesigner))
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11
6
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
14
8
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
-
22
- Modular Scale
23
- Copyright (C) 2013 Scott Kellum, Mason Wendell
24
-
25
- This program is free software: you can redistribute it and/or modify
26
- it under the terms of the GNU General Public License as published by
27
- the Free Software Foundation, either version 3 of the License, or
28
- (at your option) any later version.
29
-
30
- This program is distributed in the hope that it will be useful,
31
- but WITHOUT ANY WARRANTY; without even the implied warranty of
32
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33
- GNU General Public License for more details.
34
-
35
- You should have received a copy of the GNU General Public License
36
- along with this program. If not, see <http://www.gnu.org/licenses/>.
9
+ **The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.**
data/readme.md ADDED
@@ -0,0 +1,176 @@
1
+ # Modular Scale
2
+
3
+ A modular scale is a list of values that share the same relationship. These values are often used to size type and create a sense of harmony in a design. Proportions within modular scales are all around us from the spacing of the joints on our fingers to branches on trees. These natural proportions have been used since the time of the ancient Greeks in architecture and design and can be a tremendously helpful tool to leverage for web designers.
4
+
5
+ Ems work especially well with modular scales as their recursive properties mimic modular scales making them more predictable and easier to manage. Pixels and other units work just fine and breakpoints in responsive web design can naturally fall on your scale to create better relevance to your text as all the values in your layout harmonize with each other.
6
+
7
+ To get started, you need to select a ratio and a base value. The base value is usually your text font size or 1em. Optionally you can add another value to create a double standard modular scale which might be useful to create more options for in-between values. This base size paired with a ratio such as the golden ratio or any musical proportion will create your scale of values which all share this proportion.
8
+
9
+ ## Install
10
+
11
+ ### Compass
12
+
13
+ * Terminal: `gem install modular-scale`
14
+ * Compass config: `require 'modular-scale'`
15
+ * SCSS: `@import 'modular-scale';`
16
+
17
+ ### Bower
18
+
19
+ * Terminal: `bower install modular-scale`
20
+ * SCSS: `@import '../link_to_component_dir/modular-scale';`
21
+
22
+ ### Vanilla Sass
23
+
24
+ * [Download the latest zip](https://github.com/Team-Sass/modular-scale/releases/latest)
25
+ * Extract into your project
26
+ * SCSS: `@import 'modular-scale';`
27
+
28
+ ## Compatibility
29
+
30
+ I have been working incredibly hard to make Modular Scale compatible with multiple versions of Sass. As a result, it will work and has been tested in **Libsass**, **Sass 3.2**, **Sass 3.3**, and **Sass 3.4**.
31
+
32
+ These are dramatically different environments so things may have slight differences. **[For best results, install via the gem with Compass](https://github.com/Team-Sass/modular-scale/tree/2.x#compass)**.
33
+
34
+ #### **Compass + Sass (best):**
35
+
36
+ * non-integer values work with the `ms()` function. (Compass only)
37
+ * Significant speed increases as the gem does calculations natively in Ruby
38
+
39
+ #### **Libsass:**
40
+
41
+ * Everything should be working, and work very quickly.
42
+
43
+ #### **Vanilla Sass:**
44
+
45
+ * Works fine, but is slow when using multiple bases and ratios.
46
+
47
+ ## Usage
48
+
49
+ Modular Scale has two default variables that you should place with your other site wide variables. `$ms-base` is usually your font size or `1em` and can have multiple values. `$ms-ratio` is the factor of change between each number so if the ratio is `1.5` then each number in the sequence will be 1.5 times that of the previous number. Just as you can have multiple bases you can have multiple ratios.
50
+
51
+ ```scss
52
+ $ms-base: 1em;
53
+ $ms-ratio: $golden;
54
+ ```
55
+
56
+ Modular-scale is used as a function. Simply pass it through in place of any value to generate a value based on a modular scale.
57
+
58
+ ```scss
59
+ font-size: ms(2); // two up the modular scale
60
+ font-size: ms(2, 16px); // two up the modular scale with a base size of 16px, default is 1em
61
+ font-size: ms(2, 1em, $octave); // Same as above but on an octave scale
62
+ ```
63
+
64
+ You can output a list to your terminal to help you find out what values are on your scale.
65
+
66
+ ```scss
67
+ @debug ms-list($start, $end, $ms-base, $ms-ratio);
68
+ ```
69
+
70
+ You can use a double standard scale by simply adding more base sizes in a space-sepreated list.
71
+ **note:** the starting point of the scale will always be the **first** value in this list
72
+
73
+ ```scss
74
+ .double-standard {
75
+ width: ms(7, 1em 2em);
76
+ }
77
+ ```
78
+
79
+ You can do the same thing with ratios
80
+
81
+ ```scss
82
+ .multi-ratio {
83
+ width: ms(7, 1em, $golden $octave);
84
+ }
85
+ ```
86
+
87
+ You can use multiple $ms-bases and multiple $ms-ratio together
88
+
89
+ ```scss
90
+ .multibase-multiratio {
91
+ width: ms(7, 16px 24px, $golden $fourth);
92
+ }
93
+ ```
94
+
95
+ ## Ratios
96
+
97
+ Modular scale includes functions for a number of classic design and musical scale ratios. You can add your own ratios as well.
98
+
99
+ By default, the variable `$ms-ratio` is set to `$golden`.
100
+
101
+ <table>
102
+
103
+ <tr><th>Function</th><th>Ratio</th><th>Decimal value</th></tr>
104
+
105
+ <tr><td>$phi</td><td>1:1.618</td><td>1.618</td></tr>
106
+ <tr><td>$golden</td><td>1:1.618</td><td>1.618</td></tr>
107
+ <tr><td>$double-octave</td><td>1:4</td><td>4</td></tr>
108
+ <tr><td>$major-twelfth</td><td>1:3</td><td>3</td></tr>
109
+ <tr><td>$major-eleventh</td><td>3:8</td><td>2.667</td></tr>
110
+ <tr><td>$major-tenth</td><td>2:5</td><td>2.5</td></tr>
111
+ <tr><td>$octave</td><td>1:2</td><td>2</td></tr>
112
+ <tr><td>$major-seventh</td><td>8:15</td><td>1.875</td></tr>
113
+ <tr><td>$minor-seventh</td><td>9:16</td><td>1.778</td></tr>
114
+ <tr><td>$major-sixth</td><td>3:5</td><td>1.667</td></tr>
115
+ <tr><td>$minor-sixth</td><td>5:8</td><td>1.6</td></tr>
116
+ <tr><td>$fifth</td><td>2:3</td><td>1.5</td></tr>
117
+ <tr><td>$augmented-fourth</td><td>1:√2</td><td>1.414</td></tr>
118
+ <tr><td>$fourth</td><td>3:4</td><td>1.333</td></tr>
119
+ <tr><td>$major-third</td><td>4:5</td><td>1.25</td></tr>
120
+ <tr><td>$minor-third</td><td>5:6</td><td>1.2</td></tr>
121
+ <tr><td>$major-second</td><td>8:9</td><td>1.125</td></tr>
122
+ <tr><td>$minor-second</td><td>15:16</td><td>1.067</td></tr>
123
+
124
+ </table>
125
+
126
+ Add your own ratio in Sass by setting a variable and passing that to modular-scale.
127
+
128
+ ```scss
129
+ $my-ratio: 1 / 3.14159265;
130
+ $ms-ratio: $my-ratio;
131
+ ```
132
+
133
+ ## Responsive scales
134
+
135
+ At times you may want to have a scale with less contrast on small screens and big type with more contrast on larger screens. For this you can use the `ms-respond` mixin that allows you to plug in a range of ratios at various breakpoints.
136
+
137
+ First, you will need to set your range. A range is a list of ratio and breakpoint values from smallest to largest.
138
+
139
+ ```scss
140
+ $ms-range:
141
+ 1.2 20em,
142
+ 1.3 30em,
143
+ 1.4 40em,
144
+ 1.5 50em,
145
+ 1.6 60em;
146
+ ```
147
+
148
+ Now you can use the `ms-respond` mixin to output a range of values for a single point on a scale.
149
+
150
+ ```scss
151
+ foo {
152
+ @include ms-respond(font-size, 2);
153
+ }
154
+ ```
155
+
156
+ ```css
157
+ foo { font-size: 1.44em; }
158
+ @media (min-width: 30em) { foo { font-size: 1.69em; } }
159
+ @media (min-width: 40em) { foo { font-size: 1.96em; } }
160
+ @media (min-width: 50em) { foo { font-size: 2.25em; } }
161
+ @media (min-width: 60em) { foo { font-size: 2.56em; } }
162
+ ```
163
+
164
+ ## [Changelog](https://github.com/Team-Sass/modular-scale/releases)
165
+
166
+ ### Licence
167
+
168
+ The MIT License (MIT)
169
+
170
+ Copyright © 2015 [Scott Kellum](http://www.scottkellum.com/) ([@scottkellum](http://twitter.com/scottkellum)), [Adam Stacoviak](http://adamstacoviak.com/) ([@adamstac](http://twitter.com/adamstac)) and [Mason Wendell](http://thecodingdesigner.com/) ([@codingdesigner](http://twitter.com/codingdesigner))
171
+
172
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
173
+
174
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
175
+
176
+ **The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and non-infringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.**
@@ -2,6 +2,7 @@
2
2
 
3
3
  $ms-base: 1em !default;
4
4
  $ms-ratio: $golden !default;
5
+ $ms-range: null !default;
5
6
 
6
7
  @import "modular-scale/tests";
7
8
 
@@ -9,5 +10,8 @@ $ms-ratio: $golden !default;
9
10
  @import "modular-scale/calc";
10
11
  @import "modular-scale/generate-list";
11
12
  @import "modular-scale/sort-list";
13
+ @import "modular-scale/round-px";
12
14
  @import "modular-scale/function";
13
- @import "modular-scale/function-list";
15
+ @import "modular-scale/function-list";
16
+
17
+ @import "modular-scale/respond";
@@ -1,12 +1,12 @@
1
1
  // The main function that brings it all together
2
2
  @function ms($Value: 0, $Bases: $ms-base, $Ratios: $ms-ratio) {
3
-
3
+
4
4
  // If no multi-base or multi-ratio stuff is going on
5
5
  // then just retrn the basic calculaiton
6
6
  @if length($Bases) == 1 and length($Ratios) == 1 {
7
- @return ms-calc($Value, $Bases, $Ratios);
7
+ @return ms-round-px(ms-calc($Value, $Bases, $Ratios));
8
8
  }
9
-
9
+
10
10
  // Do calculations directly in Ruby when avalible
11
11
  @if $MS-gem-exists {
12
12
 
@@ -17,14 +17,14 @@
17
17
  $Base: $Base/$Unit;
18
18
  $Unitless-Bases: join($Unitless-Bases, $Base);
19
19
  }
20
-
20
+
21
21
  // Calculate natively in Ruby
22
- @return ms-gem-func($Value, $Unitless-Bases, $Ratios) * $Unit;
22
+ @return ms-round-px(ms-gem-func($Value, $Unitless-Bases, $Ratios) * $Unit);
23
23
  }
24
-
24
+
25
25
  // Generate a list of all possible values
26
26
  $Return: ms-generate-list($Value, $Bases, $Ratios);
27
-
27
+
28
28
  // Sort the generated lists
29
29
  $Return: ms-sort-list($Return);
30
30
 
@@ -36,17 +36,17 @@
36
36
  }
37
37
  $Return: $MS-new-return;
38
38
  }
39
-
39
+
40
40
  // Normalize value for counting from 1
41
41
  // Because CSS counts things from 1
42
42
  // So Sass does as well
43
43
  // So I get to write fun stuff like this
44
44
  $Value: abs($Value) + 1;
45
-
45
+
46
46
  // Find the correct value in the list
47
47
  $Return: nth($Return, $Value);
48
48
 
49
- @return $Return;
49
+ @return ms-round-px($Return);
50
50
  }
51
51
 
52
52
  // Same function, different name, for good measure.
@@ -0,0 +1,16 @@
1
+ @mixin ms-respond($property, $value, $range: $ms-range, $base: $ms-base) {
2
+ @if $ms-range == null {
3
+ #{$property}: ms($value,$base,$ms-ratio);
4
+ } @else {
5
+ @for $i from 1 through length($range) {
6
+ @debug nth($range,$i);
7
+ @if $i == 1 {
8
+ #{$property}: ms($value,$base,nth(nth($range,$i),1));
9
+ } @else {
10
+ @media (min-width: nth(nth($range,$i),2)) {
11
+ #{$property}: ms($value,$base,nth(nth($range,$i),1));
12
+ }
13
+ }
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,6 @@
1
+ @function ms-round-px($Result) {
2
+ @if unit($Result) == 'px' {
3
+ @return round($Result);
4
+ }
5
+ @return $Result;
6
+ }
metadata CHANGED
@@ -1,11 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular-scale
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
5
- prerelease:
4
+ version: 2.0.6
6
5
  platform: ruby
7
6
  authors:
8
- - First Last
7
+ - Scott Kellum
8
+ - Mason Wendell
9
+ - Adam Stacoviak
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
@@ -14,28 +15,38 @@ dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: compass
16
17
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - ">="
20
20
  - !ruby/object:Gem::Version
21
21
  version: 0.12.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
- - - ! '>='
26
+ - - ">="
28
27
  - !ruby/object:Gem::Version
29
28
  version: 0.12.0
30
- description: A generalized Compass extension to build off of
29
+ description: |-
30
+ A modular scale is a list of values that share the same relationship. These
31
+ values are often used to size type and create a sense of harmony in a design. Proportions within
32
+ modular scales are all around us from the spacing of the joints on our fingers to branches on
33
+ trees. These natural proportions have been used since the time of the ancient Greeks in
34
+ architecture and design and can be a tremendously helpful tool to leverage for web designers.
31
35
  email:
32
- - firstlast@extension.com
36
+ - scott@scottkellum.com
37
+ - mason@thecodingdesigner.com
38
+ - adam@stacoviak.com
33
39
  executables: []
34
40
  extensions: []
35
- extra_rdoc_files: []
36
- files:
41
+ extra_rdoc_files:
42
+ - changelog.md
37
43
  - license.md
44
+ - readme.md
45
+ files:
46
+ - changelog.md
38
47
  - lib/modular-scale.rb
48
+ - license.md
49
+ - readme.md
39
50
  - stylesheets/_modular-scale-tests.scss
40
51
  - stylesheets/_modular-scale.scss
41
52
  - stylesheets/modular-scale/_calc.scss
@@ -44,35 +55,32 @@ files:
44
55
  - stylesheets/modular-scale/_generate-list.scss
45
56
  - stylesheets/modular-scale/_pow.scss
46
57
  - stylesheets/modular-scale/_ratios.scss
58
+ - stylesheets/modular-scale/_respond.scss
59
+ - stylesheets/modular-scale/_round-px.scss
47
60
  - stylesheets/modular-scale/_sort-list.scss
48
61
  - stylesheets/modular-scale/_tests.scss
49
- - stylesheets/modular-scale.zip
50
- homepage: http://extension.com
62
+ homepage: http://modularscale.com
51
63
  licenses:
52
64
  - MIT
65
+ metadata: {}
53
66
  post_install_message:
54
67
  rdoc_options: []
55
68
  require_paths:
56
69
  - lib
57
70
  required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
71
  requirements:
60
- - - ! '>='
72
+ - - ">="
61
73
  - !ruby/object:Gem::Version
62
74
  version: '0'
63
- segments:
64
- - 0
65
- hash: 2121142932601040971
66
75
  required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
76
  requirements:
69
- - - ! '>='
77
+ - - ">="
70
78
  - !ruby/object:Gem::Version
71
79
  version: 1.3.6
72
80
  requirements: []
73
- rubyforge_project: modular-scale
74
- rubygems_version: 1.8.23
81
+ rubyforge_project:
82
+ rubygems_version: 2.2.2
75
83
  signing_key:
76
- specification_version: 3
77
- summary: An easy to use system for writing and managing media queries.
84
+ specification_version: 4
85
+ summary: Modular scale calculator built into your Sass.
78
86
  test_files: []
Binary file