Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Rocket.Chat.Fuselage
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
RocketChat
Rocket.Chat.Fuselage
Commits
35891751
Commit
35891751
authored
Jun 03, 2020
by
Tasso Evangelista
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand color naming
parent
8b634833
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
13 deletions
+48
-13
packages/fuselage/src/styles/colors.scss
packages/fuselage/src/styles/colors.scss
+41
-12
packages/fuselage/src/styles/props/colors.js
packages/fuselage/src/styles/props/colors.js
+7
-1
No files found.
packages/fuselage/src/styles/colors.scss
View file @
35891751
...
...
@@ -10,6 +10,12 @@ $-map-type-to-prefix: (
success
:
'g'
,
warning
:
'y'
,
danger
:
'r'
,
red
:
'r'
,
orange
:
'o'
,
yellow
:
'y'
,
green
:
'g'
,
blue
:
'b'
,
purple
:
'p'
,
);
@function
_get-palette-color
(
$type
,
$grade
,
$alpha
)
{
...
...
@@ -42,34 +48,57 @@ $-map-type-to-prefix: (
@return
(
--
rcx-color-
#{
$type
}
-
#{
$grade
}
,
$base-color
);
}
@function
neutral
(
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
neutral
,
$grade
,
$alpha
);
@function
_refer-palette-color
(
$type
,
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
$type
,
$grade
,
$alpha
);
@return
var
(
list
.
nth
(
$pair
,
1
)
,
list
.
nth
(
$pair
,
2
));
}
@function
neutral
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
neutral
,
$grade
,
$alpha
);
}
@function
primary
(
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
primary
,
$grade
,
$alpha
);
@return
var
(
list
.
nth
(
$pair
,
1
)
,
list
.
nth
(
$pair
,
2
));
@return
_refer-palette-color
(
primary
,
$grade
,
$alpha
);
}
@function
info
(
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
info
,
$grade
,
$alpha
);
@return
var
(
list
.
nth
(
$pair
,
1
)
,
list
.
nth
(
$pair
,
2
));
@return
_refer-palette-color
(
info
,
$grade
,
$alpha
);
}
@function
success
(
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
success
,
$grade
,
$alpha
);
@return
var
(
list
.
nth
(
$pair
,
1
)
,
list
.
nth
(
$pair
,
2
));
@return
_refer-palette-color
(
success
,
$grade
,
$alpha
);
}
@function
warning
(
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
warning
,
$grade
,
$alpha
);
@return
var
(
list
.
nth
(
$pair
,
1
)
,
list
.
nth
(
$pair
,
2
));
@return
_refer-palette-color
(
warning
,
$grade
,
$alpha
);
}
@function
danger
(
$grade
,
$alpha
:
null
)
{
$pair
:
_get-palette-color
(
danger
,
$grade
,
$alpha
);
@return
var
(
list
.
nth
(
$pair
,
1
)
,
list
.
nth
(
$pair
,
2
));
@return
_refer-palette-color
(
danger
,
$grade
,
$alpha
);
}
@function
red
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
'red'
,
$grade
,
$alpha
);
}
@function
orange
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
'orange'
,
$grade
,
$alpha
);
}
@function
yellow
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
'yellow'
,
$grade
,
$alpha
);
}
@function
green
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
'green'
,
$grade
,
$alpha
);
}
@function
blue
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
'blue'
,
$grade
,
$alpha
);
}
@function
purple
(
$grade
,
$alpha
:
null
)
{
@return
_refer-palette-color
(
'purple'
,
$grade
,
$alpha
);
}
@function
surface
()
{
...
...
packages/fuselage/src/styles/props/colors.js
View file @
35891751
...
...
@@ -13,6 +13,12 @@ const mapTypeToPrefix = {
success
:
'
g
'
,
warning
:
'
y
'
,
danger
:
'
r
'
,
red
:
'
r
'
,
orange
:
'
o
'
,
yellow
:
'
y
'
,
green
:
'
g
'
,
blue
:
'
b
'
,
purple
:
'
p
'
,
};
const
getPaletteColor
=
(
type
,
grade
,
alpha
)
=>
{
...
...
@@ -63,7 +69,7 @@ const getForegroundColor = (type) => {
return
[
`--rcx-color-foreground-
${
type
}
`
,
color
];
};
const
paletteColorRegex
=
/^
(
neutral|primary|info|success|warning|danger
)
-
(\d
+
)(
-
(\d
+
))?
$/
;
const
paletteColorRegex
=
/^
(
[
a-z
]
+
)
-
(\d
+
)(
-
(\d
+
))?
$/
;
export
const
getColorValue
=
memoize
((
propValue
)
=>
{
if
(
propValue
===
undefined
||
propValue
===
null
||
typeof
propValue
!==
'
string
'
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment