Skip to content

Commit 0ff588e

Browse files
committed
fix(lib): support rgba with four args
1 parent 0d308ff commit 0ff588e

File tree

5 files changed

+8161
-1354
lines changed

5 files changed

+8161
-1354
lines changed

lib/functions.sass

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,21 @@
4848
$num: str-slice(quote($perccalc), 0, -2) // remove '%''
4949
@return wrap(#{$color}--#{$num}--desaturate)
5050
51-
@function rgba($col, $alpha)
51+
@function rgba($r, $g, $b: null, $alpha: null)
52+
@if type-of($r) == number and type-of($g) == number and type-of($b) == number and type-of($alpha) == number
53+
@return rgb($r, $g, $b, $alpha)
54+
$col: $r
55+
$alpha: $g
5256
@if type-of($col) == 'color'
5357
@return color.change($col, $alpha: $alpha)
58+
@else if type-of($col) == 'color'
59+
@return color.change($col, $alpha: $alpha)
5460
@else
5561
$color: unwrap($col)
5662
@if str-index($color, "--") == 1
57-
@return wrap(#{$color}--#{$alpha * 100}--rgba)
63+
@return wrap(#{$color}--#{$g * 100}--rgba)
5864
@else
59-
@return color.change($color, $alpha: $alpha)
65+
@return color.change($color, $alpha: $g)
6066
6167
@function adjust-hue($col, $deg)
6268
@if type-of($col) == 'color'

lib/jest.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
globals: {
33
'ts-jest': {
4-
tsConfig: '<rootDir>/tsconfig.test.json'
4+
tsconfig: '<rootDir>/tsconfig.test.json'
55
}
66
},
77
transform: {'^.+\\.(ts|js)$': 'ts-jest'},

0 commit comments

Comments
 (0)