Skip to content

Commit 3acc845

Browse files
author
AMJones
committed
Better protection against map overwriting for multiple inclusions.
1 parent 18802d0 commit 3acc845

3 files changed

Lines changed: 16 additions & 8 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"strapless"
1010
],
1111
"homepage": "https://www.github.com/strapless/colors",
12-
"version": "1.0.4",
12+
"version": "1.0.5",
1313
"authors": [
1414
{
1515
"name": "Aaron M Jones",

scss/_colors-functions.scss

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,25 @@
5959
}
6060

6161
@function theme-colors-merge($new: ()) {
62-
$theme-colors: () !default;
62+
@if not(variable-exists(theme-colors)) {
63+
$theme-colors: () !global;
64+
}
6365

6466
@return color-map-merge($theme-colors, $new);
6567
}
6668

6769
@function colors-merge($new: ()) {
68-
$colors: () !default;
70+
@if not(variable-exists(colors)) {
71+
$colors: () !global;
72+
}
6973

7074
@return color-map-merge($colors, $new);
7175
}
7276

7377
@function grays-merge($new: ()) {
74-
$grays: () !default;
78+
@if not(variable-exists(grays)) {
79+
$grays: () !global;
80+
}
7581

7682
@return color-map-merge($grays, $new);
7783
}
@@ -120,7 +126,9 @@
120126
// region ////////////////////////////////////////////// Other Color Functions
121127

122128
@function isLight($color) {
123-
@if (lightness($color) > 50) {
129+
@if quote($color) == "transparent" {
130+
@return true;
131+
} @else if (lightness($color) > 50) {
124132
@return true;
125133
} @else {
126134
@return false;

scss/_colors-variables.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ $colors: colors-merge((
4444
"gray-dark": $gray-800,
4545
"gray-light": $gray-700,
4646
"gray-lighter": $gray-300
47-
));
47+
)) !default;
4848

4949
$grays: grays-merge((
5050
"50": $gray-50,
@@ -57,7 +57,7 @@ $grays: grays-merge((
5757
"700": $gray-700,
5858
"800": $gray-800,
5959
"900": $gray-900
60-
));
60+
)) !default;
6161

6262

6363
$theme-colors: theme-colors-merge((
@@ -67,6 +67,6 @@ $theme-colors: theme-colors-merge((
6767
"info": $cyan,
6868
"warning": $yellow,
6969
"danger": $red,
70-
));
70+
)) !default;
7171

7272
// endregion //////////////////////////////////////////////////////////// End Color Map

0 commit comments

Comments
 (0)