accoutrement 0.0.1 → 0.0.2

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.
data/README.md CHANGED
@@ -16,7 +16,107 @@ who are very smart.
16
16
  [snugug]: https://github.com/Snugug/
17
17
  [canarymason]: https://github.com/canarymason/
18
18
 
19
- ## License
19
+ List of Things
20
+ --------------
21
+
22
+ ### Background
23
+
24
+ **Functions:**
25
+ - `convert-gradient-angle($deg)`:
26
+ - `convert-linear($angle, $details...)`:
27
+ - `stripes($position, $colors)`
28
+ - `get-palette($color [, $tints, $shades])`
29
+
30
+ **Mixins:**
31
+ - `gradient-background-image($gradient...)`:
32
+ - `palette($color [, $tints, $shades])`
33
+
34
+ ### Color
35
+
36
+ *The idea of color-stacks comes from [toolkit][],
37
+ though I've made some alterations to fit into my own process.*
38
+
39
+ **Settings**:
40
+ - `$contrasted-dark-default : black !default;`
41
+ - `$contrasted-light-default : white !default;`
42
+ - `$default-amounts : 20% 40% 60% 70% 80% !default;`
43
+ - `$default-tints : $default-amounts !default;`
44
+ - `$default-shades : $default-amounts !default;`
45
+
46
+ **Functions:**
47
+ - `brightness($color)`
48
+ - `contrast($color [, $contrast])`
49
+ - `color-stack($main, $second [, $amounts])`
50
+ - `tint-stack($color [, $amounts])`
51
+ - `shade-stack($color [, $amounts])`
52
+ - `color($color [, $alpha, $tints, $shades])`
53
+
54
+ ### Math
55
+
56
+ **Functions:**
57
+ - `mod($dividend, $divisor)`
58
+
59
+ ### Media
60
+
61
+ *These are also adapted from [toolkit][].*
62
+
63
+ **Settings:**
64
+ - `$default-fluid-width : max-width 100% !default;`
65
+ - `$default-fluid-elements : 'img, video' !default;`
66
+ - `$default-fluid-ratio : 16/9 !default;`
67
+ - `$default-fluid-ratio-width : 100% !default;`
68
+ - `$default-fluid-ratio-children : '*' !default;`
69
+
70
+ **Mixins:**
71
+ - `fluid-media([$width, $elements])`
72
+ - `fluid-ratio([$ratio, $width, $children])`
73
+
74
+ ### Pseudo-Elements
75
+
76
+ **Mixins:**
77
+ - `@include before($content)`
78
+ - `@include after($content)`
79
+ - `@include wrap($content)`
80
+
81
+ ### Rhythm
82
+
83
+ **Functions:**
84
+ - `px-to-rhythm($px [, $from, $round])`
85
+ - `rhythm-image($image [, $from, $round])`
86
+
87
+ ### Sass Lists
88
+
89
+ **Functions:**
90
+ - `reverse($list)`
91
+ - `remove-duplicates($list)`
92
+ - `filter($list, $target)`
93
+
94
+ ### Tabs
95
+
96
+ **Settings:**
97
+ - `$default-checked-selector : ':checked' !default;`
98
+ - `$default-nested-selectors : null !default;`
99
+ - `$toggle-attribute : id !default;`
100
+ - `$title-attribute : for !default;`
101
+ - `$content-attribute : class !default;`
102
+
103
+ **Mixins:**
104
+ - `@include tab-defaults`
105
+ - `@include make-tabs($slugs [, $nested, $checked])`
106
+
107
+ ### Type
108
+
109
+ **Settings:**
110
+ - `$default-dropcap-size : $base-font-size * 2 !default;`
111
+ - `$default-dropcap-lines : false !default;`
112
+ - `$default-dropcap-padding : null !default;`
113
+ - `$default-dropcap-font-family : null !default;`
114
+
115
+ **Mixins:**
116
+ - `dropcap([$size, $lines, $padding, $from-size]) { @content }`
117
+
118
+ License
119
+ -------
20
120
 
21
121
  Copyright © Eric Meyer.
22
122
 
@@ -1,10 +1,59 @@
1
+ // ----------------------------------------------------------------------------
2
+ // Brightness
3
+
4
+ // Returns the visual brightness of a color.
5
+ //
6
+ // brightness($color)
7
+ // - $color: You know.
8
+ @function brightness($color) {
9
+ @return round((red($color) * 299) + (green($color) * 587) + (blue($color) * 114) / 1000);
10
+ }
11
+
12
+ // ----------------------------------------------------------------------------
13
+ // Contrast
14
+
15
+ // Set the default light and dark contrasts.
16
+ $contrasted-dark-default : black !default;
17
+ $contrasted-light-default : white !default;
18
+
19
+ // Return a light or dark option based on best visual contrast.
20
+ //
21
+ // contrast($color [, $contrast])
22
+ // - $color: The known color to contrast against.
23
+ // - $contrast: Two colors (light and dark) to pick for best contrast.
24
+ @function contrast(
25
+ $color,
26
+ $contrast: $contrasted-dark-default $contrasted-light-default
27
+ ) {
28
+ $contrasted-light: false;
29
+ $contrasted-dark: false;
30
+
31
+ @if length($contrast) == 2 {
32
+ $light1: brightness(nth($contrast,1));
33
+ $light2: brightness(nth($contrast,2));
34
+ $contrasted-light: if($light1 > $light2, nth($contrast,1), nth($contrast,2));
35
+ $contrasted-dark: if($light1 < $light2, nth($contrast,1), nth($contrast,2));
36
+ } @else {
37
+ @warn "Contrast takes two colors (light & dark) for the second argument.";
38
+ }
39
+
40
+ $color-brightness: brightness($color);
41
+ $light-contrast-brightness: brightness($contrasted-light);
42
+ $dark-contrast-brightness: brightness($contrasted-dark);
43
+
44
+ $light-diff: abs($color-brightness - $light-contrast-brightness);
45
+ $dark-diff: abs($color-brightness - $dark-contrast-brightness);
46
+
47
+ @return if($light-diff > $dark-diff, $contrasted-light, $contrasted-dark);
48
+ }
49
+
1
50
  // ----------------------------------------------------------------------------
2
51
  // Color Stacks
3
52
 
4
- // Set the default mixing intervals for use in color stacks
5
- $default-amounts : 20% 40% 60% 70% 80%;
6
- $default-tints : $default-amounts;
7
- $default-shades : $default-amounts;
53
+ // Set the default mixing intervals for use in color stacks.
54
+ $default-amounts : 20% 40% 60% 70% 80% !default;
55
+ $default-tints : $default-amounts !default;
56
+ $default-shades : $default-amounts !default;
8
57
 
9
58
  // Returns a list of mixed colors at given intervals
10
59
  // based on two initial source colors.
@@ -12,7 +61,7 @@ $default-shades : $default-amounts;
12
61
  // color-stack($main, $second [, $amounts])
13
62
  // - $main : The main color this stack is based on.
14
63
  // - $second : The color to be mixed in at varrying amounts.
15
- // - $amounts : Optional list of percentage mix intervals;
64
+ // - $amounts : Optional list of percentage mix intervals.
16
65
  @function color-stack(
17
66
  $main,
18
67
  $second,
@@ -78,15 +127,19 @@ $default-shades : $default-amounts;
78
127
  $shades: $default-shades
79
128
  ) {
80
129
  $saturation: false;
81
- $light: false;
82
- $base: false;
130
+ $lightness: false;
131
+ $hue: hsl(0,0%,50%);
132
+ $has-hue: false;
83
133
  $index: 0;
84
134
 
85
135
  @each $arg in $color {
86
- @if type-of($arg) == 'color' { $base: $arg; }
136
+ @if type-of($arg) == 'color' {
137
+ $hue: $arg;
138
+ $has-hue: true;
139
+ }
87
140
  @if type-of($arg) == 'number' {
88
141
  @if unit($arg) != '' {
89
- @if $base { $light: $arg; }
142
+ @if $has-hue or length($color) == 1 { $lightness: $arg; }
90
143
  @else{ $saturation: $arg; }
91
144
  }
92
145
  @else { $index: $arg; }
@@ -105,25 +158,25 @@ $default-shades : $default-amounts;
105
158
  }
106
159
  }
107
160
 
108
- @if $light and $light != 0 {
109
- @if $light > 0 { $base: tint($base,$light); }
110
- @else { $base: shade($base,abs($light)); }
161
+ @if $lightness and $lightness != 0 {
162
+ @if $lightness > 0 { $hue: tint($hue,$lightness); }
163
+ @else { $hue: shade($hue,abs($lightness)); }
111
164
  } @else if $index and $index != 0 {
112
165
  $color-stack: compact();
113
166
  @if $index > 0 {
114
167
  $index: $index + 1;
115
- $color-stack: tint-stack($base, $tints);
168
+ $color-stack: tint-stack($hue, $tints);
116
169
  } @else {
117
170
  $index: abs($index) + 1;
118
- $color-stack: shade-stack($base, $shades);
171
+ $color-stack: shade-stack($hue, $shades);
119
172
  }
120
173
  @if $index <= length($color-stack) {
121
- $base: nth($color-stack,$index);
174
+ $hue: nth($color-stack,$index);
122
175
  } @else {
123
176
  @warn "You don't have #{$index - 1} colors in this stack";
124
177
  }
125
178
  }
126
179
 
127
- @if $saturation { $base: scale-color($base, $saturation: $saturation); }
128
- @return rgba($base, $alpha);
180
+ @if $saturation { $hue: scale-color($hue, $saturation: $saturation); }
181
+ @return rgba($hue, $alpha);
129
182
  }
@@ -2,7 +2,7 @@
2
2
  // Fluid Media
3
3
 
4
4
  // Default property-value pair for setting fluid width.
5
- $default-fluid-width : max-width 100%;
5
+ $default-fluid-width : max-width 100% !default;
6
6
 
7
7
  // Default list of elements for the fluid-media mixin.
8
8
  $default-fluid-elements : 'img, video' !default;
@@ -26,7 +26,7 @@
26
26
 
27
27
  // Return a list with specific items removed
28
28
  //
29
- // remove-duplicates($list, $target)
29
+ // filter($list, $target)
30
30
  // - $list : The list to filter.
31
31
  // - $target : An item to be removed from the list.
32
32
  @function filter($list, $target) {
@@ -1,18 +1,17 @@
1
1
  // ----------------------------------------------------------------------------
2
2
  // Typography
3
3
 
4
- // @private base settings
5
- $base-font-size : 16px !default;
4
+ // Default size of the dropcap (in px)
5
+ $default-dropcap-size : $base-font-size * 2 !default;
6
+
7
+ // Default number of rhythm-lines for dropcap line-height
8
+ $default-dropcap-lines : false !default;
6
9
 
7
10
  // The default padding on a dropcap letter
8
- $default-dropcap-padding : null;
11
+ $default-dropcap-padding : null !default;
9
12
 
10
13
  // The default font settings (null == inherit)
11
- $default-dropcap-font-family : null;
12
- $default-dropcap-font-weight : null;
13
- $default-dropcap-font-style : null;
14
- $default-dropcap-font-variant : null;
15
- $default-dropcap-text-transform : null;
14
+ $default-dropcap-font-family : null !default;
16
15
 
17
16
  // Creates a dropcap using the :first-letter selector
18
17
  //
@@ -24,12 +23,13 @@ $default-dropcap-text-transform : null;
24
23
  // - $font-family : Optional font-stack for the dropcap.
25
24
  // - @content : Optionally override the default dropcap styles as needed.
26
25
  @mixin dropcap(
27
- $size : $base-font-size*2,
28
- $lines : lines-for-font-size($size),
26
+ $size : $default-dropcap-size,
27
+ $lines : $default-dropcap-lines,
29
28
  $padding : $default-dropcap-padding,
30
29
  $from-size : $base-font-size,
31
30
  $font-family : $default-dropcap-font-family
32
31
  ) {
32
+ $lines: if($lines, $lines, lines-for-font-size($size));
33
33
  &:first-letter {
34
34
  @include adjust-font-size-to($size,$lines,$from-size);
35
35
  font-family: $font-family;
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accoutrement
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric Meyer